mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
576cf5c269
commit
276b13b33d
@ -1,75 +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.02'
|
__version__ = 'v1.02'
|
||||||
__date__ = '14, March 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:
|
# NOTE: the feeds url are broken on the main site as the permalink structure has been changed erroneously ie:
|
||||||
# actual link in feed http://www.corriere.it/english/10_marzo_11/legitimate_impediment_approved_de9ba480-2cfd-11df-a00c-00144f02aabe.shtml
|
# 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
|
# this needs to be change to
|
||||||
# real feed URL http://www.corriere.it/International/english/articoli/2010/03/11/legitimate_impediment_approved.shtml
|
# real feed URL http://www.corriere.it/International/english/articoli/2010/03/11/legitimate_impediment_approved.shtml
|
||||||
'''
|
'''
|
||||||
http://www.corriere.it/
|
http://www.corriere.it/
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class ilCorriereEn(BasicNewsRecipe):
|
class ilCorriereEn(BasicNewsRecipe):
|
||||||
author = 'Lorenzo Vigentini, based on Darko Miletic'
|
author = 'Lorenzo Vigentini, based on Darko Miletic'
|
||||||
description = 'Italian daily newspaper (english version)'
|
description = 'Italian daily newspaper (english version)'
|
||||||
|
|
||||||
cover_url = 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520'
|
cover_url = 'http://images.corriereobjects.it/images/static/common/logo_home.gif?v=200709121520'
|
||||||
title = u'Il Corriere della sera (english) '
|
title = u'Il Corriere della sera (english) '
|
||||||
publisher = 'RCS Digital'
|
publisher = 'RCS Digital'
|
||||||
category = 'News, politics, culture, economy, general interest'
|
category = 'News, politics, culture, economy, general interest'
|
||||||
|
|
||||||
language = 'en'
|
language = 'en'
|
||||||
timefmt = '[%a, %d %b, %Y]'
|
timefmt = '[%a, %d %b, %Y]'
|
||||||
|
|
||||||
oldest_article = 5
|
oldest_article = 5
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
recursion = 10
|
recursion = 10
|
||||||
|
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
|
||||||
def get_article_url(self, article):
|
def get_article_url(self, article):
|
||||||
articleUrl= article.get('link')
|
articleUrl= article.get('link')
|
||||||
segments = articleUrl.split('/')
|
segments = articleUrl.split('/')
|
||||||
basename = '/'.join(segments[:3]) + '/' + 'International/english/articoli/'
|
basename = '/'.join(segments[:3]) + '/' + 'International/english/articoli/'
|
||||||
|
|
||||||
#the date has to be redone with the url structure
|
#the date has to be redone with the url structure
|
||||||
mlist1 = ['gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre']
|
mlist1 = ['gennaio','febbraio','marzo','aprile','maggio','giugno','luglio','agosto','settembre','ottobre','novembre','dicembre']
|
||||||
mlist2 = ['01','02','03','04','05','06','07','08','09','10','11','12']
|
mlist2 = ['01','02','03','04','05','06','07','08','09','10','11','12']
|
||||||
myDate = segments[4].split('_')
|
myDate = segments[4].split('_')
|
||||||
x=0
|
x=0
|
||||||
for x in range(11):
|
for x in range(11):
|
||||||
if myDate[1] == mlist1[x]:
|
if myDate[1] == mlist1[x]:
|
||||||
noMonth=mlist2[x]
|
noMonth=mlist2[x]
|
||||||
break
|
break
|
||||||
|
|
||||||
newDateUrl= '20'+ myDate[0] + '/' + noMonth + '/' + myDate[2] + '/'
|
newDateUrl= '20'+ myDate[0] + '/' + noMonth + '/' + myDate[2] + '/'
|
||||||
|
|
||||||
#clean the article title
|
#clean the article title
|
||||||
articleURLseg=segments[5].split('-')
|
articleURLseg=segments[5].split('-')
|
||||||
myArticle = (articleURLseg[0])[:-9] + '.shtml'
|
myArticle = (articleURLseg[0])[:-9] + '.shtml'
|
||||||
|
|
||||||
myURL= basename + newDateUrl + myArticle
|
myURL= basename + newDateUrl + myArticle
|
||||||
#print myURL
|
#print myURL
|
||||||
return myURL
|
return myURL
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':['news-dettaglio article','article']})]
|
keep_only_tags = [dict(name='div', attrs={'class':['news-dettaglio article','article']})]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['base','object','link','embed']),
|
dict(name=['base','object','link','embed']),
|
||||||
dict(name='div', attrs={'class':'news-goback'}),
|
dict(name='div', attrs={'class':'news-goback'}),
|
||||||
dict(name='ul', attrs={'class':'toolbar'})
|
dict(name='ul', attrs={'class':'toolbar'})
|
||||||
]
|
]
|
||||||
|
|
||||||
remove_tags_after = dict(name='p', attrs={'class':'footnotes'})
|
remove_tags_after = dict(name='p', attrs={'class':'footnotes'})
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'News' , u'http://www.corriere.it/rss/english.xml' )
|
(u'News' , u'http://www.corriere.it/rss/english.xml' )
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user