Debian Codegraph @

recipes/elektroda_pl.recipe

raw
1 from calibre.ebooks.BeautifulSoup import BeautifulSoup
2 from calibre.web.feeds.news import BasicNewsRecipe
3
4
5 class Elektroda(BasicNewsRecipe):
6 title = 'Elektroda'
7 oldest_article = 8
8 __author__ = 'fenuks'
9 description = 'Międzynarodowy portal elektroniczny udostępniający bogate zasoby z dziedziny elektroniki oraz forum dyskusyjne.'
10 cover_url = 'http://demotywatory.elektroda.pl/Thunderpic/logo.gif'
11 category = 'electronics'
12 language = 'pl'
13 max_articles_per_feed = 100
14 no_stylesheets = True
15 feeds = [('Elektroda', 'http://www.elektroda.pl/rtvforum/rss.php')]
16
17 keep_only_tags = [dict(name='div', attrs={'class': 'title-wrap pull-left'}), dict(name='ul', attrs={'class': 'topic-lists clearfix'})]
18
19 def preprocess_html(self, soup):
20 tag = soup.find('span', attrs={'class': 'postbody'})
21 if tag:
22 pos = len(tag.contents)
23 tag.insert(pos, BeautifulSoup('<br />'))
24 return soup
25
26 def parse_feeds(self):
27 feeds = BasicNewsRecipe.parse_feeds(self)
28 for feed in feeds:
29 for article in feed.articles[:]:
30 article.title = article.title[article.title.find('::') + 3 :]
31 return feeds