recipes: fix kosmonauta.net

This commit is contained in:
Tomasz Długosz 2016-10-14 00:01:38 +02:00
parent e7dd6770e7
commit 4b571f1553

View File

@ -10,30 +10,11 @@ class Kosmonauta(BasicNewsRecipe):
category = 'astronomy'
language = 'pl'
cover_url = 'http://bi.gazeta.pl/im/4/10393/z10393414X,Kosmonauta-net.jpg'
extra_css = '.thumb-left {float:left; margin-right:5px;} .calibre_navbar {clear: both;}'
no_stylesheets = True
INDEX = 'http://www.kosmonauta.net'
oldest_article = 7
no_stylesheets = True
remove_javascript = True
remove_attributes = ['style']
max_articles_per_feed = 100
keep_only_tags = [dict(name='div', attrs={'class': 'item-page'})]
remove_tags = [dict(attrs={'class': ['article-tools clearfix', 'cedtag', 'nav clearfix',
'jwDisqusForm']}), dict(attrs={'alt': ['Poprzednia strona', 'Następna strona']})]
remove_tags_after = dict(name='div', attrs={'class': 'cedtag'})
feeds = [(u'Kosmonauta.net', u'http://www.kosmonauta.net/?format=feed&type=atom')]
feeds = [(u'Kosmonauta.net', u'http://www.kosmonauta.net/feed')]
def print_version(self, url):
return url + '?tmpl=component&print=1&layout=default&page='
def preprocess_html(self, soup):
for a in soup.findAll(name='a'):
if a.has_key('href'): # noqa
href = a['href']
if not href.startswith('http'):
a['href'] = self.INDEX + href
for a in soup.findAll(name='img'):
if a.has_key('style') and 'float:' in a['style']: # noqa
a['class'] = 'thumb-left'
return soup