| 1 |
#!/usr/bin/env python |
| 2 |
__license__ = 'GPL v3' |
| 3 |
__author__ = 'Gabriele Marini, based on Darko Miletic' |
| 4 |
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' |
| 5 |
description = 'Italian daily newspaper - v1.01 (04, January 2010)' |
| 6 |
|
| 7 |
''' |
| 8 |
http://www.messaggero.it/ |
| 9 |
''' |
| 10 |
import time |
| 11 |
|
| 12 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 13 |
|
| 14 |
|
| 15 |
class IlMessaggero(BasicNewsRecipe): |
| 16 |
__author__ = 'Gabriele Marini' |
| 17 |
description = 'Italian News' |
| 18 |
|
| 19 |
# cover_url = 'http://www.ilmessaggero.it/img_tst/logomsgr.gif' |
| 20 |
title = 'Il Messaggero' |
| 21 |
publisher = 'Caltagirone Editore' |
| 22 |
category = 'News, politics, culture, economy, general interest' |
| 23 |
|
| 24 |
language = 'it' |
| 25 |
timefmt = '[%a, %d %b, %Y]' |
| 26 |
|
| 27 |
oldest_article = 5 |
| 28 |
max_articles_per_feed = 100 |
| 29 |
use_embedded_content = False |
| 30 |
recursion = 10 |
| 31 |
|
| 32 |
remove_javascript = True |
| 33 |
extra_css = ' .bianco31lucida{color: black} ' |
| 34 |
|
| 35 |
keep_only_tags = [ |
| 36 |
dict(name='h1', attrs={'class': ['titoloLettura2', 'titoloart', 'bianco31lucida']}), |
| 37 |
dict(name='h2', attrs={'class': ['sottotitLettura', 'grigio16']}), |
| 38 |
dict(name='span', attrs={'class': 'testoArticoloG'}), |
| 39 |
dict(name='div', attrs={'id': 'testodim'}), |
| 40 |
] |
| 41 |
|
| 42 |
def get_cover_url(self): |
| 43 |
cover = None |
| 44 |
st = time.localtime() |
| 45 |
year = str(st.tm_year) |
| 46 |
month = '%.2d' % st.tm_mon |
| 47 |
day = '%.2d' % st.tm_mday |
| 48 |
cover = 'http://carta.ilmessaggero.it/' + year + month + day + '/jpeg/MSGR_20_CITTA_1.jpg' |
| 49 |
br = BasicNewsRecipe.get_browser(self) |
| 50 |
try: |
| 51 |
br.open(cover) |
| 52 |
except Exception: |
| 53 |
self.log('\nCover unavailable') |
| 54 |
cover = 'http://www.ilmessaggero.it/img_tst/logomsgr.gif' |
| 55 |
|
| 56 |
return cover |
| 57 |
|
| 58 |
feeds = [ |
| 59 |
('HomePage', 'http://www.ilmessaggero.it/rss/home.xml'), |
| 60 |
('Primo Piano', 'http://www.ilmessaggero.it/rss/initalia_primopiano.xml'), |
| 61 |
('Economia e Finanza', 'http://www.ilmessaggero.it/rss/economia.xml'), |
| 62 |
('Politica', 'http://www.ilmessaggero.it/rss/initalia_politica.xml'), |
| 63 |
('Cultura', 'http://www.ilmessaggero.it/rss/cultura.xml'), |
| 64 |
('Tecnologia', 'http://www.ilmessaggero.it/rss/tecnologia.xml'), |
| 65 |
('Spettacoli', 'http://www.ilmessaggero.it/rss/spettacoli.xml'), |
| 66 |
('Edizioni Locali', 'http://www.ilmessaggero.it/rss/edlocali.xml'), |
| 67 |
('Roma', 'http://www.ilmessaggero.it/rss/roma.xml'), |
| 68 |
('Benessere', 'http://www.ilmessaggero.it/rss/benessere.xml'), |
| 69 |
('Sport', 'http://www.ilmessaggero.it/rss/sport.xml'), |
| 70 |
('Moda', 'http://www.ilmessaggero.it/rss/moda.xml'), |
| 71 |
] |