mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Helsingin Sanomat
This commit is contained in:
parent
f6c52c3d20
commit
6756388c24
@ -1,6 +1,11 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
||||||
|
def classes(classes):
|
||||||
|
q = frozenset(classes.split(' '))
|
||||||
|
return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
||||||
|
|
||||||
|
|
||||||
class AdvancedUserRecipe1298137661(BasicNewsRecipe):
|
class AdvancedUserRecipe1298137661(BasicNewsRecipe):
|
||||||
title = u'Helsingin Sanomat'
|
title = u'Helsingin Sanomat'
|
||||||
__author__ = 'oneillpt'
|
__author__ = 'oneillpt'
|
||||||
@ -9,15 +14,21 @@ class AdvancedUserRecipe1298137661(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
conversion_options = {
|
keep_only_tags = [
|
||||||
'linearize_tables': True
|
classes('article-title single-article'),
|
||||||
}
|
]
|
||||||
keep_only_tags = [dict(name='div', attrs={'id': 'main-content'}),
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class': 'contentNewsArticle'})]
|
dict(attrs={'class':['hidden print-url', 'article-paywall']}),
|
||||||
|
dict(style=lambda x: x and 'height: 0' in x),
|
||||||
|
]
|
||||||
|
|
||||||
feeds = [(u'Uutiset - HS.fi', u'http://www.hs.fi/uutiset/rss/'), (u'Politiikka - HS.fi', u'http://www.hs.fi/politiikka/rss/'),
|
feeds = [
|
||||||
(u'Ulkomaat - HS.fi', u'http://www.hs.fi/ulkomaat/rss/'), (u'Kulttuuri - HS.fi',
|
(u'Uutiset - HS.fi', u'http://www.hs.fi/uutiset/rss/'),
|
||||||
u'http://www.hs.fi/kulttuuri/rss/'),
|
]
|
||||||
(u'Kirjat - HS.fi', u'http://www.hs.fi/kulttuuri/kirjat/rss/'), (u'Elokuvat - HS.fi',
|
|
||||||
u'http://www.hs.fi/kulttuuri/elokuvat/rss/')
|
def preprocess_html(self, soup):
|
||||||
]
|
for tag in soup.findAll(attrs={'data-mfp-src':True}):
|
||||||
|
tag.name = 'img'
|
||||||
|
tag['src'] = tag['data-mfp-src']
|
||||||
|
tag['style'] = 'display:block'
|
||||||
|
return soup
|
||||||
|
Loading…
x
Reference in New Issue
Block a user