Debian Codegraph @

recipes/deutsche_welle_sr.recipe

raw
1 from calibre.web.feeds.news import BasicNewsRecipe, classes
2
3
4 class DeutscheWelle_sr(BasicNewsRecipe):
5 title = 'Deutsche Welle'
6 __author__ = 'unkn0wn'
7 description = 'Vesti iz Nemacke i sveta'
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 = 'sr'
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 remove_javascript = True
19 ignore_duplicate_articles = {'title', 'url'}
20 remove_attributes = ['height', 'width', 'style']
21
22 recipe_specific_options = {
23 'days': {
24 'short': 'Oldest article to download from this news source. In days ',
25 'long': 'For example, 0.5, gives you articles from the past 12 hours',
26 'default': str(oldest_article),
27 }
28 }
29
30 def __init__(self, *args, **kwargs):
31 BasicNewsRecipe.__init__(self, *args, **kwargs)
32 d = self.recipe_specific_options.get('days')
33 if d and isinstance(d, str):
34 self.oldest_article = float(d)
35
36 def preprocess_html(self, soup):
37 for img in soup.findAll('img', srcset=True):
38 img['src'] = img['srcset'].split()[6]
39 return soup
40
41 keep_only_tags = [dict(name='article')]
42
43 remove_tags = [dict(name=['footer', 'source']), dict(attrs={'data-tracking-name': 'sharing-icons-inline'}), classes('kicker advertisement vjs-wrapper')]
44
45 feeds = [
46 ('Politika', 'http://rss.dw-world.de/rdf/rss-ser-pol'),
47 ('Srbija', 'http://rss.dw-world.de/rdf/rss-ser-pol-ser'),
48 ('Region', 'http://rss.dw-world.de/rdf/rss-ser-pol-region'),
49 ('Evropa', 'http://rss.dw-world.de/rdf/rss-ser-pol-eu'),
50 ('Nemacka', 'http://rss.dw-world.de/rdf/rss-ser-pol-ger'),
51 ('Svet', 'http://rss.dw-world.de/rdf/rss-ser-pol-ger'),
52 ('Pregled stampe', 'http://rss.dw-world.de/rdf/rss-ser-pol-ger'),
53 ('Nauka Tehnika Medicina', 'http://rss.dw-world.de/rdf/rss-ser-science'),
54 ('Kultura', 'feed:http://rss.dw-world.de/rdf/rss-ser-cul'),
55 ]