This commit is contained in:
Kovid Goyal 2016-10-14 09:13:20 +05:30
commit b409d7b378
3 changed files with 9 additions and 27 deletions

View File

@ -12,11 +12,12 @@ class Elektroda(BasicNewsRecipe):
language = 'pl'
max_articles_per_feed = 100
no_stylesheets = True
remove_tags_before = dict(name='span', attrs={'class': 'postbody'})
remove_tags_after = dict(name='td', attrs={'class': 'spaceRow'})
remove_tags = [dict(name='a', attrs={'href': '#top'})]
feeds = [(u'Elektroda', u'http://www.elektroda.pl/rtvforum/rss.php')]
keep_only_tags = [dict(name='div', attrs={'class': 'title-wrap pull-left'}),
dict(name='ul', attrs={'class': 'topic-lists clearfix'})
]
def preprocess_html(self, soup):
tag = soup.find('span', attrs={'class': 'postbody'})
if tag:

View File

@ -3,7 +3,7 @@
__license__ = 'GPL v3'
__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com \
2013, Tomasz Długosz, tomek3d@gmail.com'
2013-2016, Tomasz Długosz, tomek3d@gmail.com'
from calibre.web.feeds.news import BasicNewsRecipe
import re
@ -51,7 +51,7 @@ class GN(BasicNewsRecipe):
return feeds
def find_articles(self, main_block):
for a in main_block.findAll('div', attrs={'class': ['prev_doc2', 'sr-document']}):
for a in main_block.findAll('div', attrs={'class': ['prev_doc_n1 prev_doc_img21']}):
art = a.find('a')
yield {
'title': self.tag_to_string(art),
@ -81,8 +81,8 @@ class GN(BasicNewsRecipe):
]
remove_tags = [
dict(name='p', attrs={'class': ['r tr', 'l l-2', 'wykop']}),
dict(name='div', attrs={'class': ['doc_actions', 'cf', 'fr1_cl']}),
dict(name='p', attrs={'class': ['r tr', 'l l-2', 'wykop', 'l l-2 doc-source']}),
dict(name='div', attrs={'class': ['doc_actions', 'cf', 'fr1_cl','txt__social-icons','txt__tags']}),
dict(name='div', attrs={'id': 'vote'}),
dict(name='a', attrs={'class': 'img_enlarge'})
]

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