Debian Codegraph @

recipes/jijinews.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2010, Hiroshi Miura <[email protected]>'
3 '''
4 www.jiji.com
5 '''
6
7 from calibre.web.feeds.news import BasicNewsRecipe
8
9
10 class JijiDotCom(BasicNewsRecipe):
11 title = '\u6642\u4e8b\u901a\u4fe1'
12 __author__ = 'Hiroshi Miura'
13 description = 'World News from Jiji Press'
14 publisher = 'Jiji Press Ltd.'
15 category = 'news'
16 oldest_article = 6
17 max_articles_per_feed = 100
18 encoding = 'euc_jisx0213'
19 language = 'ja'
20 masthead_url = 'http://jen.jiji.com/images/logo_jijipress.gif'
21 top_url = 'http://www.jiji.com/'
22
23 feeds = [('\u30cb\u30e5\u30fc\u30b9', 'http://www.jiji.com/rss/ranking.rdf')]
24
25 remove_tags_before = dict(id='article-area')
26 remove_tags_after = dict(id='ad_google')
27
28 def get_cover_url(self):
29 cover_url = 'http://www.jiji.com/img/top_header_logo2.gif'
30 soup = self.index_to_soup(self.top_url)
31 cover_item = soup.find('div', attrs={'class': 'top-pad-photos'})
32 if cover_item:
33 cover_url = self.top_url + cover_item.img['src']
34 return cover_url