Debian Codegraph @

recipes/deutsche_welle_pt.recipe

raw
1 from calibre.web.feeds.news import BasicNewsRecipe, classes
2
3
4 class DeutscheWelle_pt(BasicNewsRecipe):
5 title = 'Deutsche Welle'
6 __author__ = 'unkn0wn'
7 description = 'Noticias desde Alemania y mundo'
8 publisher = 'Deutsche Welle'
9 category = 'news, politics, Germany'
10 oldest_article = 2
11 max_articles_per_feed = 100
12 use_embedded_content = False
13 no_stylesheets = True
14 language = 'pt'
15 publication_type = 'newsportal'
16 remove_empty_feeds = True
17 masthead_url = 'http://www.dw-world.de/skins/std/channel1/pics/dw_logo1024.gif'
18
19 remove_javascript = True
20 ignore_duplicate_articles = {'title', 'url'}
21 remove_attributes = ['height', 'width', 'style']
22
23 recipe_specific_options = {
24 'days': {
25 'short': 'Oldest article to download from this news source. In days ',
26 'long': 'For example, 0.5, gives you articles from the past 12 hours',
27 'default': str(oldest_article),
28 }
29 }
30
31 def __init__(self, *args, **kwargs):
32 BasicNewsRecipe.__init__(self, *args, **kwargs)
33 d = self.recipe_specific_options.get('days')
34 if d and isinstance(d, str):
35 self.oldest_article = float(d)
36
37 def preprocess_html(self, soup):
38 for img in soup.findAll('img', srcset=True):
39 img['src'] = img['srcset'].split()[6]
40 return soup
41
42 keep_only_tags = [dict(name='article')]
43
44 remove_tags = [dict(name=['footer', 'source']), dict(attrs={'data-tracking-name': 'sharing-icons-inline'}), classes('kicker advertisement vjs-wrapper')]
45
46 feeds = [('Noticias', 'http://rss.dw-world.de/rdf/rss-br-all')]