Improved Il Messagero and Leggo (it)

This commit is contained in:
Kovid Goyal 2010-05-19 15:39:15 -06:00
parent 6fcff2462e
commit ec208049c5
2 changed files with 39 additions and 8 deletions

View File

@ -7,14 +7,14 @@ description = 'Italian daily newspaper - v1.01 (04, January 2010)'
'''
http://www.messaggero.it/
'''
import time
from calibre.web.feeds.news import BasicNewsRecipe
class IlMessaggero(BasicNewsRecipe):
__author__ = 'Gabriele Marini'
description = 'Italian News'
cover_url = 'http://www.ilmessaggero.it/img_tst/logomsgr.gif'
# cover_url = 'http://www.ilmessaggero.it/img_tst/logomsgr.gif'
title = u'Il Messaggero'
publisher = 'Caltagirone Editore'
category = 'News, politics, culture, economy, general interest'
@ -34,6 +34,21 @@ class IlMessaggero(BasicNewsRecipe):
dict(name='h2', attrs={'class':'sottotitLettura'}),
dict(name='span', attrs={'class':'testoArticoloG'})
]
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
cover='http://carta.ilmessaggero.it/' + year + month + day + '/jpeg/MSGR_20_CITTA_1.jpg'
br = BasicNewsRecipe.get_browser()
try:
br.open(cover)
except:
self.log("\nCover unavailable")
cover = 'http://www.ilmessaggero.it/img_tst/logomsgr.gif'
return cover
@ -53,4 +68,4 @@ class IlMessaggero(BasicNewsRecipe):
(u'Calcio', u'http://www.ilmessaggero.it/rss/sport_calcio.xml'),
(u'Motori', u'http://www.ilmessaggero.it/rss/sport_motori.xml')
]

View File

@ -7,14 +7,14 @@ description = 'Italian daily newspaper - v1.00 05-05-2010'
'''
http://www.leggo.it
'''
import time
from calibre.web.feeds.news import BasicNewsRecipe
class LeggoIT(BasicNewsRecipe):
__author__ = 'Gabriele Marini'
description = 'Italian Free daily newspaper'
cover_url = 'http://www.leggo.it/img/logo-leggo2.gif'
# cover_url = 'http://www.leggo.it/img/logo-leggo2.gif'
title = u'Leggo.it'
publisher = 'Ced Caltagirone Editore S.p.A.'
category = 'News, politics, culture, economy, general interest'
@ -33,8 +33,8 @@ class LeggoIT(BasicNewsRecipe):
keep_only_tags = [
dict(name='h1',attrs={'class':'nero22'}),
dict(name='div',attrs={'id':'testodim'})
]
dict(name='div',attrs={'id':'testodim'})
]
feeds = [
(u'Home Page', u'http://www.leggo.it/rss/home.xml'),
(u'Italia', u'http://www.leggo.it/rss/italia.xml'),
@ -45,5 +45,21 @@ class LeggoIT(BasicNewsRecipe):
(u'Spettacoli', u'http://www.leggo.it/rss/spettacoli.xml'),
(u'Salute', u'http://www.leggo.it/rss/salute.xml'),
(u'Scienza', u'http://www.leggo.it/rss/scienza.xml')
]
]
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
cover='http://www.leggo.it/'+ year + month + day + '/jpeg/LEGGO_ROMA_1.jpg'
br = BasicNewsRecipe.get_browser()
try:
br.open(cover)
except:
self.log("\nCover unavailable")
cover = 'http://www.leggo.it/img/logo-leggo2.gif'
return cover