Debian Codegraph @

recipes/izvestia.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3
4 __license__ = 'GPL v3'
5 __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
6 '''
7 izvestia.ru
8 '''
9
10 from calibre.web.feeds.news import BasicNewsRecipe
11
12
13 class Izvestia(BasicNewsRecipe):
14 title = 'Izvestia'
15 __author__ = 'Darko Miletic (with fixes by bugmen00t)'
16 description = 'News from Russia'
17 publisher = 'Izvestia'
18 category = 'news, politics, Russia'
19 oldest_article = 5
20 max_articles_per_feed = 100
21 auto_cleanup = False
22 no_stylesheets = True
23 use_embedded_content = False
24 language = 'ru'
25 publication_type = 'newspaper'
26 cover_url = 'https://cdn.iz.ru/profiles/portal/themes/purple/images/favicons/apple-icon-180x180.png'
27
28 remove_tags_before = dict(name='div', attrs={'role': 'article'})
29
30 remove_tags_after = dict(name='div', attrs={'role': 'article'})
31
32 remove_tags = [
33 dict(name='div', attrs={'class': 'article_page__left__top__views'}),
34 dict(name='div', attrs={'class': 'hash_tags'}),
35 dict(name='div', attrs={'class': 'get_yandex_subscription_links'}),
36 dict(name='div', attrs={'class': 'article_buttons_block'}),
37 dict(name='div', attrs={'class': 'rubrics_btn'}),
38 dict(name='div', attrs={'class': 'hidden'}),
39 dict(name='div', attrs={'class': 'share_bottom2'}),
40 dict(name='div', attrs={'class': 'recommendation-block'}),
41 dict(name='div', attrs={'class': 'plug-text'}),
42 dict(name='div', attrs={'class': 'get_news_link'}),
43 dict(name='div', attrs={'itemprop': 'address'}),
44 ]
45
46 feeds = [('Новости', 'https://iz.ru/xml/rss/all.xml')]
47
48 def preprocess_html(self, soup):
49 for img in soup.findAll('img', attrs={'data-src': True}):
50 img['src'] = img['data-src']
51 return soup