Debian Codegraph @

recipes/unian_net_en.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 Unian(BasicNewsRecipe):
8 title = 'UNIAN'
9 description = (
10 'UNIAN (Ukrainian Independent News Agency of News) is the largest independent news agency,'
11 " first in Ukraine, founded in 1993, remaining the leader among the country's news media,"
12 ' being the most cited source of news from across Ukraine.'
13 )
14 __author__ = 'bugmen00t'
15 publication_type = 'newspaper'
16 oldest_article = 30
17 max_articles_per_feed = 100
18 language = 'en_UK'
19 cover_url = 'https://www.unian.info/images/unian-512x512.png'
20 auto_cleanup = False
21 no_stylesheets = True
22
23 remove_tags_before = dict(name='h1')
24 remove_tags_after = dict(name='div', attrs={'class': 'article-text'})
25 remove_tags = [
26 dict(name='span', attrs={'class': 'article__info-item comments'}),
27 dict(name='span', attrs={'class': 'article__info-item views'}),
28 dict(name='div', attrs={'class': 'read-also-slider'}),
29 dict(name='div', attrs={'class': 'nts-video-wrapper'}),
30 ]
31
32 feeds = [('News Agency UNIAN', 'https://rss.unian.net/site/news_eng.rss')]
33
34 def preprocess_html(self, soup):
35 for img in soup.findAll('img', attrs={'data-src': True}):
36 img['src'] = img['data-src']
37 return soup