Fix Corriere Della Seraa (EN)

This commit is contained in:
Kovid Goyal 2010-03-15 18:16:26 +05:30
parent 7bafe49277
commit 576cf5c269

View File

@ -1,55 +1,75 @@
#!/usr/bin/env python #!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini, based on Darko Miletic' __author__ = 'Lorenzo Vigentini, based on Darko Miletic'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>, Lorenzo Vigentini <l.vigentini at gmail.com>' __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>, Lorenzo Vigentini <l.vigentini at gmail.com>'
__version__ = 'v1.01' __version__ = 'v1.02'
__date__ = '10, January 2010' __date__ = '14, March 2010'
__description__ = 'Italian daily newspaper (english version)' __description__ = 'Italian daily newspaper (english version)'
''' # NOTE: the feeds url are broken on the main site as the permalink structure has been changed erroneously ie:
http://www.corriere.it/ # actual link in feed http://www.corriere.it/english/10_marzo_11/legitimate_impediment_approved_de9ba480-2cfd-11df-a00c-00144f02aabe.shtml
''' # this needs to be change to
# real feed URL http://www.corriere.it/International/english/articoli/2010/03/11/legitimate_impediment_approved.shtml
from calibre.web.feeds.news import BasicNewsRecipe '''
http://www.corriere.it/
class ilCorriere(BasicNewsRecipe): '''
__author__ = 'Lorenzo Vigentini, based on Darko Miletic'
description = 'Italian daily newspaper (english version)' from calibre.web.feeds.news import BasicNewsRecipe
cover_url = 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520' class ilCorriereEn(BasicNewsRecipe):
title = u'Il Corriere della sera (english) ' author = 'Lorenzo Vigentini, based on Darko Miletic'
publisher = 'RCS Digital' description = 'Italian daily newspaper (english version)'
category = 'News, politics, culture, economy, general interest'
cover_url = 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520'
language = 'en' title = u'Il Corriere della sera (english) '
timefmt = '[%a, %d %b, %Y]' publisher = 'RCS Digital'
category = 'News, politics, culture, economy, general interest'
oldest_article = 1
max_articles_per_feed = 100 language = 'en'
use_embedded_content = False timefmt = '[%a, %d %b, %Y]'
recursion = 10
oldest_article = 5
remove_javascript = True max_articles_per_feed = 100
no_stylesheets = True use_embedded_content = False
recursion = 10
html2lrf_options = [
'--comment', description remove_javascript = True
, '--category', category no_stylesheets = True
, '--publisher', publisher
, '--ignore-tables' def get_article_url(self, article):
] articleUrl= article.get('link')
segments = articleUrl.split('/')
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' basename = '/'.join(segments[:3]) + '/' + 'International/english/articoli/'
keep_only_tags = [dict(name='div', attrs={'class':['news-dettaglio article','article']})] #the date has to be redone with the url structure
mlist1 = ['gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre']
remove_tags = [ mlist2 = ['01','02','03','04','05','06','07','08','09','10','11','12']
dict(name=['base','object','link','embed']), myDate = segments[4].split('_')
dict(name='div', attrs={'class':'news-goback'}), x=0
dict(name='ul', attrs={'class':'toolbar'}) for x in range(11):
] if myDate[1] == mlist1[x]:
noMonth=mlist2[x]
remove_tags_after = dict(name='p', attrs={'class':'footnotes'}) break
feeds = [ newDateUrl= '20'+ myDate[0] + '/' + noMonth + '/' + myDate[2] + '/'
(u'News' , u'http://www.corriere.it/rss/english.xml' )
] #clean the article title
articleURLseg=segments[5].split('-')
myArticle = (articleURLseg[0])[:-9] + '.shtml'
myURL= basename + newDateUrl + myArticle
#print myURL
return myURL
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'})
feeds = [
(u'News' , u'http://www.corriere.it/rss/english.xml' )
]