Debian Codegraph @

recipes/habr.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3
4 from calibre.web.feeds.news import BasicNewsRecipe
5
6
7 class Habr(BasicNewsRecipe):
8 title = 'Habr'
9 __author__ = 'bugmen00t'
10 description = 'Russian collaborative blog about IT, computer science and anything related to the Internet'
11 publisher = 'Habr Blockchain Publishing LTD'
12 category = 'blog'
13 cover_url = 'https://hsto.org/webt/f1/lq/ka/f1lqkaveikdfqkb_rip_4vq4s_8.png'
14 language = 'en_RU'
15 no_stylesheets = True
16 remove_javascript = False
17 auto_cleanup = False
18 oldest_article = 30
19 max_articles_per_feed = 30
20
21 remove_tags_before = dict(name='h1')
22
23 remove_tags_after = dict(name='div', attrs={'class': 'tm-misprint-area'})
24
25 remove_tags = [dict(name='div', attrs={'class': 'tm-article-presenter__meta'}), dict(name='div', attrs={'class': 'tm-article-poll'})]
26
27 feeds = [('News', 'https://habr.com/en/rss/news/?fl=en'), ('All materials', 'https://habr.com/en/rss/all?fl=en')]
28
29 def preprocess_html(self, soup):
30 for img in soup.findAll('img', attrs={'data-src': True}):
31 img['src'] = img['data-src']
32 return soup