1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
#!/usr/bin/env python2
__license__ = 'GPL v3'
__author__ = 'Daniele Forsi'
from calibre.web.feeds.recipes import BasicNewsRecipe
class LeScienze(BasicNewsRecipe):
title = 'Le Scienze'
description = 'Edizione italiana di Scientific American'
publication_type = 'magazine'
language = 'it'
conversion_options = {
'publisher': 'Le Scienze S.p.A.',
'tags': 'science',
}
INDEX = 'http://www.lescienze.it/utility/2011/10/17/news/lista_rss-589690/'
masthead_url = 'http://www.lescienze.it/static/images/logo-le-scienze.png'
no_stylesheets = True
extra_css = '''
.img-left,.img-right{font-style:italic;font-size:75%;padding:1em;margin:auto;}
.summary{font-style:italic;font-size:120%;}
'''
keep_only_tags = [
dict(name='article', attrs={'class': 'main-article'}),
]
remove_tags = [
dict(attrs={'class': [
'adv adv-middle',
'colsx',
'correlati',
'social-toolbar-foot',
'tags',
]}),
]
remove_empty_feeds = True
def get_feeds(self):
soup = self.index_to_soup(self.INDEX)
feeds = []
for link in soup.findAll('a'):
href = link.get('href')
if href.endswith('.xml'):
title = link.string
feeds.append((title, href))
return feeds
|