recipes: fix minor bugs, add yomiuri news

- remove wrong #!(hash-bang)
  - add yomiuri online news
This commit is contained in:
Hiroshi Miura 2010-11-28 23:41:46 +09:00
parent c0c1f8225f
commit 56e38290df
11 changed files with 71 additions and 21 deletions

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''
@ -9,9 +7,9 @@ www.nikkei.com
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class NikkeiNet(BasicNewsRecipe): class NikkeiNet(BasicNewsRecipe):
title = u'\u65e5\u7d4c\u65b0\u805e\u96fb\u5b50\u7248(Free)' title = u'\u65e5\u7d4c\u65b0\u805e\u96fb\u5b50\u7248(Free, MAX)'
__author__ = 'Hiroshi Miura' __author__ = 'Hiroshi Miura'
description = 'News and current market affairs from Japan' description = 'News and current market affairs from Japan, no subscription and getting max feed.'
cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg' cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg' masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
oldest_article = 2 oldest_article = 2

View File

@ -5,12 +5,12 @@ from calibre.ptempfile import PersistentTemporaryFile
class NikkeiNet_subscription(BasicNewsRecipe): class NikkeiNet_subscription(BasicNewsRecipe):
title = u'\u65e5\u7d4c\u65b0\u805e\u96fb\u5b50\u7248' title = u'\u65e5\u7d4c\u65b0\u805e\u96fb\u5b50\u7248(MAX)'
__author__ = 'Hiroshi Miura' __author__ = 'Hiroshi Miura'
description = 'News and current market affairs from Japan' description = 'News and current market affairs from Japan, gather MAX articles'
needs_subscription = True needs_subscription = True
oldest_article = 2 oldest_article = 2
max_articles_per_feed = 20 max_articles_per_feed = 10
language = 'ja' language = 'ja'
remove_javascript = False remove_javascript = False
temp_files = [] temp_files = []

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'
''' '''

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>' __copyright__ = '2010, Hiroshi Miura <miurahr@linux.com>'

View File

@ -0,0 +1,66 @@
__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'
__author__ = 'Hiroshi Miura'
oldest_article = 1
max_articles_per_feed = 50
description = 'Japanese traditional newspaper Yomiuri Online News'
publisher = 'Yomiuri Online News'
category = 'news, japan'
language = 'ja'
encoding = 'Shift_JIS'
index = 'http://www.yomiuri.co.jp/latestnews/'
remove_javascript = True
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(('News', newsarticles))
return feeds