Debian Codegraph @

recipes/sanjosemercurynews.recipe

raw
1 #!/usr/bin/env python
2
3 __license__ = 'GPL v3'
4 __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
5 '''
6 www.mercurynews.com
7 '''
8
9 from calibre.web.feeds.news import BasicNewsRecipe
10
11
12 class MercuryNews(BasicNewsRecipe):
13 title = 'San Jose Mercury News'
14 __author__ = 'Darko Miletic'
15 description = 'News from San Jose'
16 cover_url = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg12/lg/CA_SJMN.jpg'
17 publisher = 'San Jose Mercury News'
18 category = 'news, politics, USA, San Jose, California'
19 oldest_article = 2
20 max_articles_per_feed = 100
21 no_stylesheets = True
22 use_embedded_content = False
23 encoding = 'utf-8'
24 language = 'en_US'
25
26 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
27
28 keep_only_tags = [
29 dict(name='h1'),
30 dict(attrs={'class': ['byline', 'time', 'article-body']}),
31 dict(attrs={'class': lambda x: x and 'header-features' in x.split()}),
32 ]
33
34 feeds = [('News', 'http://www.mercurynews.com/feed/')]
35
36 def preprocess_html(self, soup, *a):
37 for img in soup.findAll(name='img', attrs={'data-src': True}):
38 img['src'] = img['data-src']
39 return soup