Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76bcf5c
commit 570b02c
Showing
1 changed file
with
25 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,44 @@ | ||
#!/usr/bin/env python2 | ||
__license__ = 'GPL v3' | ||
__author__ = 'Lorenzo Vigentini, based on Darko Miletic' | ||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>, Lorenzo Vigentini <l.vigentini at gmail.com>' | ||
__version__ = 'v1.01' | ||
__date__ = '10, January 2010' | ||
__description__ = 'Italian daily newspaper' | ||
|
||
''' | ||
http://www.corriere.it/ | ||
''' | ||
import time | ||
#!/usr/bin/env python2 | ||
# vim:fileencoding=utf-8 | ||
from __future__ import unicode_literals, division, absolute_import, print_function | ||
from calibre.web.feeds.news import BasicNewsRecipe | ||
|
||
__author__ = 'Ruben Scopacasa' | ||
__license__ = 'GPL v3' | ||
__copyright__ = '2019, Ruben Scopacasa <ruben.scopacasa at gmail.com>' | ||
__version__ = 'v1.00' | ||
__date__ = '22, April 2019' | ||
|
||
class ilCorriere(BasicNewsRecipe): | ||
__author__ = 'Lorenzo Vigentini, based on Darko Miletic, Gabriele Marini' | ||
description = 'Italian daily newspaper' | ||
|
||
# cover_url = | ||
# 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520 | ||
|
||
class CorriereDellaSeraRecipe(BasicNewsRecipe): | ||
title = u'Il Corriere della sera' | ||
publisher = 'RCS Digital' | ||
category = 'News, politics, culture, economy, general interest' | ||
|
||
encoding = 'cp1252' | ||
language = 'it' | ||
timefmt = '[%a, %d %b, %Y]' | ||
|
||
oldest_article = 10 | ||
oldest_article = 3 | ||
max_articles_per_feed = 100 | ||
use_embedded_content = False | ||
recursion = 10 | ||
simultaneous_downloads = 5 | ||
|
||
remove_javascript = True | ||
no_stylesheets = True | ||
remove_tags_before = dict(name='h1') | ||
remove_tags = [dict(id='gallery')] | ||
ignore_duplicate_articles = {'title', 'url'} | ||
|
||
html2lrf_options = [ | ||
'--comment', description, '--category', category, '--publisher', publisher, '--ignore-tables' | ||
] | ||
|
||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + \ | ||
description + '"\ntags="' + category + '"\nlinearize_tables=True' | ||
|
||
keep_only_tags = [ | ||
dict(name='div', attrs={'class': ['news-dettaglio article', 'article']})] | ||
|
||
remove_tags = [ | ||
dict(name=['base', 'object', 'link', 'embed']), | ||
dict(name='div', attrs={'class': 'news-goback'}), | ||
dict(name='ul', attrs={'class': 'toolbar'}) | ||
feeds = [ | ||
('Homepage', 'http://xml2.corriereobjects.it/rss/homepage.xml'), | ||
('Editoriali', 'http://xml2.corriereobjects.it/rss/editoriali.xml'), | ||
('Cronache', 'http://xml2.corriereobjects.it/rss/cronache.xml'), | ||
('Politica', 'http://xml2.corriereobjects.it/rss/politica.xml'), | ||
('Esteri', 'http://xml2.corriereobjects.it/rss/esteri.xml'), | ||
('Economia', 'http://xml2.corriereobjects.it/rss/economia.xml'), | ||
('Cultura', 'http://xml2.corriereobjects.it/rss/cultura.xml'), | ||
] | ||
|
||
remove_tags_after = dict(name='p', attrs={'class': 'footnotes'}) | ||
def print_version(self, url): | ||
return url.replace('.shtml', '_print.html') | ||
|
||
def get_cover_url(self): | ||
cover = None | ||
st = time.localtime() | ||
year = str(st.tm_year) | ||
month = "%.2d" % st.tm_mon | ||
day = "%.2d" % st.tm_mday | ||
# http://images.corriere.it/primapagina/storico/2010_05_17/images/prima_pagina_grande.png | ||
cover = 'http://images.corriere.it/primapagina/storico/' + year + \ | ||
'_' + month + '_' + day + '/images/prima_pagina_grande.png' | ||
br = BasicNewsRecipe.get_browser(self) | ||
try: | ||
br.open(cover) | ||
except: | ||
self.log("\nCover unavailable") | ||
cover = 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520' | ||
return cover | ||
|
||
feeds = [ | ||
(u'Ultimora', u'http://www.corriere.it/rss/ultimora.xml'), | ||
(u'Editoriali', u'http://www.corriere.it/rss/editoriali.xml'), | ||
(u'Cronache', u'http://www.corriere.it/rss/cronache.xml'), | ||
(u'Politica', u'http://www.corriere.it/rss/politica.xml'), | ||
(u'Esteri', u'http://www.corriere.it/rss/esteri.xml'), | ||
(u'Economia', u'http://www.corriere.it/rss/economia.xml'), | ||
(u'Cultura', u'http://www.corriere.it/rss/cultura.xml'), | ||
(u'Scienze', u'http://www.corriere.it/rss/scienze.xml'), | ||
(u'Salute', u'http://www.corriere.it/rss/salute.xml'), | ||
(u'Spettacolo', u'http://www.corriere.it/rss/spettacoli.xml'), | ||
(u'Cinema e TV', u'http://www.corriere.it/rss/cinema.xml'), | ||
(u'Sport', u'http://www.corriere.it/rss/sport.xml'), | ||
(u'Roma', u'http://www.corriere.it/rss/homepage_roma.xml'), | ||
(u'Milano', u'http://www.corriere.it/rss/homepage_milano.xml') | ||
] | ||
return 'http://www.corriere.it/rss/images/logo_small.gif' |