mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
recipes: add icons and yomiuri online variant
This commit is contained in:
parent
2b2a8a1edc
commit
5f5c41e495
BIN
resources/images/news/cnetjapan_digital.png
Normal file
BIN
resources/images/news/cnetjapan_digital.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 892 B |
BIN
resources/images/news/cnetjapan_release.png
Normal file
BIN
resources/images/news/cnetjapan_release.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 892 B |
BIN
resources/images/news/yomiuri.png
Normal file
BIN
resources/images/news/yomiuri.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 660 B |
@ -8,7 +8,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
class YOLNews(BasicNewsRecipe):
|
class YOLNews(BasicNewsRecipe):
|
||||||
title = u'YOMIURI ONLINE'
|
title = u'YOMIURI ONLINE(Latest)'
|
||||||
__author__ = 'Hiroshi Miura'
|
__author__ = 'Hiroshi Miura'
|
||||||
oldest_article = 1
|
oldest_article = 1
|
||||||
max_articles_per_feed = 50
|
max_articles_per_feed = 50
|
||||||
@ -19,6 +19,7 @@ class YOLNews(BasicNewsRecipe):
|
|||||||
encoding = 'Shift_JIS'
|
encoding = 'Shift_JIS'
|
||||||
index = 'http://www.yomiuri.co.jp/latestnews/'
|
index = 'http://www.yomiuri.co.jp/latestnews/'
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
|
masthead_title = u'YOMIURI ONLINE'
|
||||||
|
|
||||||
remove_tags_before = {'class':"article-def"}
|
remove_tags_before = {'class':"article-def"}
|
||||||
remove_tags = [{'class':"RelatedArticle"},
|
remove_tags = [{'class':"RelatedArticle"},
|
||||||
@ -27,9 +28,7 @@ class YOLNews(BasicNewsRecipe):
|
|||||||
remove_tags_after = {'class':"date-def"}
|
remove_tags_after = {'class':"date-def"}
|
||||||
|
|
||||||
def parse_feeds(self):
|
def parse_feeds(self):
|
||||||
|
|
||||||
feeds = BasicNewsRecipe.parse_feeds(self)
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||||
|
|
||||||
for curfeed in feeds:
|
for curfeed in feeds:
|
||||||
delList = []
|
delList = []
|
||||||
for a,curarticle in enumerate(curfeed.articles):
|
for a,curarticle in enumerate(curfeed.articles):
|
||||||
@ -39,7 +38,6 @@ class YOLNews(BasicNewsRecipe):
|
|||||||
for d in delList:
|
for d in delList:
|
||||||
index = curfeed.articles.index(d)
|
index = curfeed.articles.index(d)
|
||||||
curfeed.articles[index:index+1] = []
|
curfeed.articles[index:index+1] = []
|
||||||
|
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
@ -60,7 +58,6 @@ class YOLNews(BasicNewsRecipe):
|
|||||||
,'url' :'http://www.yomiuri.co.jp' + itema['href']
|
,'url' :'http://www.yomiuri.co.jp' + itema['href']
|
||||||
,'description':''
|
,'description':''
|
||||||
})
|
})
|
||||||
feeds.append(('News', newsarticles))
|
feeds.append(('latest', newsarticles))
|
||||||
|
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
|
63
resources/recipes/yomiuri_world.recipe
Normal file
63
resources/recipes/yomiuri_world.recipe
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
|
||||||
|
'''
|
||||||
|
www.yomiuri.co.jp
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
import re
|
||||||
|
|
||||||
|
class YOLNews(BasicNewsRecipe):
|
||||||
|
title = u'YOMIURI ONLINE(World)'
|
||||||
|
__author__ = 'Hiroshi Miura'
|
||||||
|
oldest_article = 2
|
||||||
|
max_articles_per_feed = 50
|
||||||
|
description = 'Japanese traditional newspaper Yomiuri Online News/world news'
|
||||||
|
publisher = 'Yomiuri Online News'
|
||||||
|
category = 'news, japan'
|
||||||
|
language = 'ja'
|
||||||
|
encoding = 'Shift_JIS'
|
||||||
|
index = 'http://www.yomiuri.co.jp/world/'
|
||||||
|
remove_javascript = True
|
||||||
|
masthead_title = u"YOMIURI ONLINE"
|
||||||
|
|
||||||
|
remove_tags_before = {'class':"article-def"}
|
||||||
|
remove_tags = [{'class':"RelatedArticle"},
|
||||||
|
{'class':"sbtns"}
|
||||||
|
]
|
||||||
|
remove_tags_after = {'class':"date-def"}
|
||||||
|
|
||||||
|
def parse_feeds(self):
|
||||||
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||||
|
for curfeed in feeds:
|
||||||
|
delList = []
|
||||||
|
for a,curarticle in enumerate(curfeed.articles):
|
||||||
|
if re.search(r'rssad.jp', curarticle.url):
|
||||||
|
delList.append(curarticle)
|
||||||
|
if len(delList)>0:
|
||||||
|
for d in delList:
|
||||||
|
index = curfeed.articles.index(d)
|
||||||
|
curfeed.articles[index:index+1] = []
|
||||||
|
return feeds
|
||||||
|
|
||||||
|
def parse_index(self):
|
||||||
|
feeds = []
|
||||||
|
soup = self.index_to_soup(self.index)
|
||||||
|
topstories = soup.find('ul',attrs={'class':'list-def'})
|
||||||
|
if topstories:
|
||||||
|
newsarticles = []
|
||||||
|
for itt in topstories.findAll('li'):
|
||||||
|
itema = itt.find('a',href=True)
|
||||||
|
if itema:
|
||||||
|
itd1 = itema.findNextSibling(text = True)
|
||||||
|
itd2 = itd1.findNextSibling(text = True)
|
||||||
|
itd3 = itd2.findNextSibling(text = True)
|
||||||
|
newsarticles.append({
|
||||||
|
'title' :itema.string
|
||||||
|
,'date' :''.join([itd1, itd2, itd3])
|
||||||
|
,'url' :'http://www.yomiuri.co.jp' + itema['href']
|
||||||
|
,'description':''
|
||||||
|
})
|
||||||
|
feeds.append(('World', newsarticles))
|
||||||
|
return feeds
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user