mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Corriere della Serra
This commit is contained in:
parent
76bcf5ca41
commit
570b02c59b
@ -1,89 +1,44 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
__license__ = 'GPL v3'
|
# vim:fileencoding=utf-8
|
||||||
__author__ = 'Lorenzo Vigentini, based on Darko Miletic'
|
from __future__ import unicode_literals, division, absolute_import, print_function
|
||||||
__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
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
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'
|
title = u'Il Corriere della sera'
|
||||||
publisher = 'RCS Digital'
|
publisher = 'RCS Digital'
|
||||||
category = 'News, politics, culture, economy, general interest'
|
category = 'News, politics, culture, economy, general interest'
|
||||||
|
|
||||||
encoding = 'cp1252'
|
|
||||||
language = 'it'
|
language = 'it'
|
||||||
timefmt = '[%a, %d %b, %Y]'
|
timefmt = '[%a, %d %b, %Y]'
|
||||||
|
|
||||||
oldest_article = 10
|
oldest_article = 3
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
use_embedded_content = False
|
simultaneous_downloads = 5
|
||||||
recursion = 10
|
|
||||||
|
|
||||||
remove_javascript = True
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
remove_tags_before = dict(name='h1')
|
||||||
html2lrf_options = [
|
remove_tags = [dict(id='gallery')]
|
||||||
'--comment', description, '--category', category, '--publisher', publisher, '--ignore-tables'
|
ignore_duplicate_articles = {'title', 'url'}
|
||||||
]
|
|
||||||
|
|
||||||
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'})
|
|
||||||
]
|
|
||||||
|
|
||||||
remove_tags_after = dict(name='p', attrs={'class': 'footnotes'})
|
|
||||||
|
|
||||||
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 = [
|
feeds = [
|
||||||
(u'Ultimora', u'http://www.corriere.it/rss/ultimora.xml'),
|
('Homepage', 'http://xml2.corriereobjects.it/rss/homepage.xml'),
|
||||||
(u'Editoriali', u'http://www.corriere.it/rss/editoriali.xml'),
|
('Editoriali', 'http://xml2.corriereobjects.it/rss/editoriali.xml'),
|
||||||
(u'Cronache', u'http://www.corriere.it/rss/cronache.xml'),
|
('Cronache', 'http://xml2.corriereobjects.it/rss/cronache.xml'),
|
||||||
(u'Politica', u'http://www.corriere.it/rss/politica.xml'),
|
('Politica', 'http://xml2.corriereobjects.it/rss/politica.xml'),
|
||||||
(u'Esteri', u'http://www.corriere.it/rss/esteri.xml'),
|
('Esteri', 'http://xml2.corriereobjects.it/rss/esteri.xml'),
|
||||||
(u'Economia', u'http://www.corriere.it/rss/economia.xml'),
|
('Economia', 'http://xml2.corriereobjects.it/rss/economia.xml'),
|
||||||
(u'Cultura', u'http://www.corriere.it/rss/cultura.xml'),
|
('Cultura', 'http://xml2.corriereobjects.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')
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url.replace('.shtml', '_print.html')
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
return 'http://www.corriere.it/rss/images/logo_small.gif'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user