Debian Codegraph @

recipes/corriere_della_sera_it.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3 from __future__ import absolute_import, division, print_function, unicode_literals
4
5 from calibre.web.feeds.news import BasicNewsRecipe
6
7 __author__ = 'Ruben Scopacasa'
8 __license__ = 'GPL v3'
9 __copyright__ = '2019, Ruben Scopacasa <ruben.scopacasa at gmail.com>'
10 __version__ = 'v1.00'
11 __date__ = '22, April 2019'
12
13
14 class CorriereDellaSeraRecipe(BasicNewsRecipe):
15 title = 'Il Corriere della sera'
16 publisher = 'RCS Digital'
17 category = 'News, politics, culture, economy, general interest'
18
19 language = 'it'
20 timefmt = '[%a, %d %b, %Y]'
21
22 oldest_article = 3
23 max_articles_per_feed = 100
24 simultaneous_downloads = 5
25
26 no_stylesheets = True
27 remove_tags_before = dict(name='h1')
28 remove_tags = [dict(id='gallery')]
29 ignore_duplicate_articles = {'title', 'url'}
30
31 recipe_specific_options = {
32 'days': {
33 'short': 'Oldest article to download from this news source. In days ',
34 'long': 'For example, 0.5, gives you articles from the past 12 hours',
35 'default': str(oldest_article),
36 }
37 }
38
39 def __init__(self, *args, **kwargs):
40 BasicNewsRecipe.__init__(self, *args, **kwargs)
41 d = self.recipe_specific_options.get('days')
42 if d and isinstance(d, str):
43 self.oldest_article = float(d)
44
45 feeds = [
46 ('Homepage', 'http://xml2.corriereobjects.it/rss/homepage.xml'),
47 ('Editoriali', 'http://xml2.corriereobjects.it/rss/editoriali.xml'),
48 ('Cronache', 'http://xml2.corriereobjects.it/rss/cronache.xml'),
49 ('Politica', 'http://xml2.corriereobjects.it/rss/politica.xml'),
50 ('Esteri', 'http://xml2.corriereobjects.it/rss/esteri.xml'),
51 ('Economia', 'http://xml2.corriereobjects.it/rss/economia.xml'),
52 ('Cultura', 'http://xml2.corriereobjects.it/rss/cultura.xml'),
53 ]
54
55 def print_version(self, url):
56 return url.replace('.shtml', '_print.html')
57
58 def get_cover_url(self):
59 return 'http://www.corriere.it/rss/images/logo_small.gif'