mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
90 lines
3.3 KiB
Python
90 lines
3.3 KiB
Python
#!/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
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
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
|
|
|
|
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
|
|
max_articles_per_feed = 100
|
|
use_embedded_content = False
|
|
recursion = 10
|
|
|
|
remove_javascript = True
|
|
no_stylesheets = True
|
|
|
|
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'})
|
|
]
|
|
|
|
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 = [
|
|
(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')
|
|
]
|