| 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__ = 'La Stampa 28/12/2012' |
| 6 |
|
| 7 |
''' |
| 8 |
http://www.lastampa.it/ |
| 9 |
''' |
| 10 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 11 |
|
| 12 |
|
| 13 |
class LaStampa(BasicNewsRecipe): |
| 14 |
title = 'La Stampa' |
| 15 |
language = 'it' |
| 16 |
__author__ = 'Gabriele Marini' |
| 17 |
oldest_articlce = 7 # for daily schedule |
| 18 |
max_articles_per_feed = 50 |
| 19 |
recursion = 100 |
| 20 |
cover_url = 'http://www1.lastampa.it/edicola/PDF/1.pdf' |
| 21 |
use_embedded_content = False |
| 22 |
remove_javascript = True |
| 23 |
no_stylesheets = True |
| 24 |
|
| 25 |
conversion_options = {'linearize_tables': True} |
| 26 |
remove_attributes = ['colspan'] |
| 27 |
|
| 28 |
extra_css = ' .boxocchiello2{font-size: small} .catenaccio{font-style: italic} .titoloRub{font-size: xx-large; font-weight: bold } .titologir{font-size: xx-large; font-weight: bold } .sezione{font-weight: bold} ' # noqa: E501 |
| 29 |
|
| 30 |
def get_article_url(self, article): |
| 31 |
link = article.get('links') |
| 32 |
if link: |
| 33 |
return link[0]['href'] |
| 34 |
|
| 35 |
keep_only_tags = [ |
| 36 |
dict( |
| 37 |
attrs={ |
| 38 |
'class': [ |
| 39 |
'boxocchiello2', |
| 40 |
'titoloRub', |
| 41 |
'titologir', |
| 42 |
'autore-girata', |
| 43 |
'luogo-girata', |
| 44 |
'catenaccio', |
| 45 |
'sezione', |
| 46 |
'articologirata', |
| 47 |
'bodytext', |
| 48 |
'news-single-img', |
| 49 |
'ls-articoloCorpo', |
| 50 |
'ls-blog-list-1col', |
| 51 |
] |
| 52 |
} |
| 53 |
), # noqa: E501 |
| 54 |
dict(name='div', attrs={'id': 'corpoarticolo'}), |
| 55 |
] |
| 56 |
|
| 57 |
remove_tags = [ |
| 58 |
dict(name='div', attrs={'id': ['menutop', 'fwnetblocco']}), |
| 59 |
dict(attrs={'class': ['ls-toolbarCommenti', 'ls-boxCommentsBlog']}), |
| 60 |
dict(name='table', attrs={'id': ['strumenti', 'imgesterna']}), |
| 61 |
dict(name='a', attrs={'class': ['linkblu', 'link']}), |
| 62 |
dict(name='span', attrs={'class': ['boxocchiello', 'boxocchiello2', 'sezione']}), |
| 63 |
] |
| 64 |
feeds = [ |
| 65 |
('BuonGiorno', 'http://www.lastampa.it/cultura/opinioni/buongiorno/rss.xml'), |
| 66 |
('Jena', 'http://www.lastampa.it/cultura/opinioni/jena/rss.xml'), |
| 67 |
('Editoriali', 'http://www.lastampa.it/cultura/opinioni/editoriali'), |
| 68 |
('Finestra sull America', 'http://lastampa.feedsportal.com/c/32418/f/625713/index.rss'), |
| 69 |
('HomePage', 'http://www.lastampa.it/rss.xml'), |
| 70 |
('Politica Italia', 'http://www.lastampa.it/italia/politica/rss.xml'), |
| 71 |
('ArciItaliana', 'http://www.lastampa.it/rss/blog/arcitaliana'), |
| 72 |
('Cronache', 'http://www.lastampa.it/italia/cronache/rss.xml'), |
| 73 |
('Esteri', 'http://www.lastampa.it/esteri/rss.xml'), |
| 74 |
('Danni Collaterali', 'http://www.lastampa.it/rss/blog/danni-collaterali'), |
| 75 |
('Economia', 'http://www.lastampa.it/economia/rss.xml'), |
| 76 |
('Tecnologia ', 'http://www.lastampa.it/tecnologia/rss.xml'), |
| 77 |
('Spettacoli', 'http://www.lastampa.it/spettacoli/rss.xml'), |
| 78 |
('Sport', 'http://www.lastampa.it/sport/rss.xml'), |
| 79 |
('Torino', 'http://www.lastampa.it/cronaca/rss.xml'), |
| 80 |
('Motori', 'http://www.lastampa.it/motori/rss.xml'), |
| 81 |
('Scienza', 'http://www.lastampa.it/scienza/rss.xml'), |
| 82 |
('Cultura', 'http://www.lastampa.it/cultura/rss.xml'), |
| 83 |
('Scuola', 'http://www.lastampa.it/cultura/scuola/rss.xml'), |
| 84 |
('Benessere', 'http://www.lastampa.it/scienza/benessere/rss.xml'), |
| 85 |
('Cucina', 'http://www.lastampa.it/societa/cucina/rss.xml'), |
| 86 |
('Casa', 'http://www.lastampa.it/societa/casa/rss.xml'), |
| 87 |
('Moda', 'http://www.lastampa.it/societa/moda/rss.xml'), |
| 88 |
('Giochi', 'http://www.lastampa.it/tecnologia/giochi/rss.xml'), |
| 89 |
('Viaggi', 'http://www.lastampa.it/societa/viaggi/rss.xml'), |
| 90 |
('Ambiente', 'http://www.lastampa.it/scienza/ambiente/rss.xml'), |
| 91 |
] |