Debian Codegraph @

recipes/parlamentni_listy.recipe

raw
1 import re
2
3 from calibre.web.feeds.recipes import BasicNewsRecipe
4
5
6 class plRecipe(BasicNewsRecipe):
7 __author__ = 'bubak'
8 title = 'Parlamentn\u00ed Listy'
9 publisher = ''
10 description = ''
11 oldest_article = 1
12 max_articles_per_feed = 40
13
14 feeds = [('Parlamentní listy.cz', 'http://www.parlamentnilisty.cz/export/rss.aspx')]
15
16 language = 'cs'
17 remove_javascript = True
18 no_stylesheets = True
19 use_embedded_content = False
20 remove_attributes = []
21 remove_tags_after = [dict(name='div', attrs={'class': re.compile(r'donate-banner|related-articles-wrap', re.IGNORECASE)})]
22 remove_tags = [
23 dict(name='div', attrs={'class': ['articledetailboxin', 'crumbs', 'relatedarticles articledetailbox']}),
24 dict(name='div', attrs={'class': ['socialshare-1 noprint', 'socialshare-2 noprint', 'advert-caption']}),
25 dict(name='div', attrs={'class': ['breadcrumbs', 'marquee', 'navbar', 'header-tags']}),
26 dict(name='div', attrs={'class': ['search-mobile', 'related-articles']}),
27 dict(name='ul', attrs={'class': ['nav navbar-nav']}),
28 dict(name='ul', attrs={'role': ['navigation']}),
29 dict(name='div', attrs={'id': ['widget', 'carousel-marquee', 'search-form-radios', 'search-form-profiles']}),
30 dict(name='img'),
31 dict(name='section', attrs={'class': 'section-brown section-inarticle related-articles'}),
32 dict(name='section', attrs={'class': 'section-blue section-inarticle profile-thumb-card'}),
33 dict(name='section', attrs={'class': 'related-articles-wrap'}),
34 dict(name='section', attrs={'class': 'section-brown section-inarticle poll'}), # does not work
35 dict(name='div', attrs={'class': 'article-discussion-box noprint'}),
36 dict(name='div', attrs={'class': re.compile(r'login-buttons', re.IGNORECASE)}),
37 dict(name='section', attrs={'class': re.compile(r'poll', re.IGNORECASE)}),
38 dict(name='div', attrs={'class': re.compile(r'social-media-buttons', re.IGNORECASE)}),
39 dict(name='div', attrs={'class': re.compile(r'alert', re.IGNORECASE)}),
40 dict(name='section', attrs={'class': re.compile(r'section-inarticle', re.IGNORECASE)}),
41 dict(attrs={'class': re.compile(r'twitter-tweet', re.IGNORECASE)}),
42 dict(name='figure'),
43 ]
44
45 preprocess_regexps = [
46 (re.compile(r'<(span|strong|p)[^>]*>\s*Ptejte se politik.*', re.DOTALL | re.IGNORECASE), lambda match: '</body>'),
47 (re.compile(r'<a\s[^>]*>(<[^>]*>)*([^<]*)(<[^>]*>)*</a>', re.DOTALL | re.IGNORECASE), lambda match: match.group(2)),
48 (re.compile(r'<(span|strong|p)[^>]*>\s*Jste politik?.*', re.DOTALL | re.IGNORECASE), lambda match: '</body>'),
49 ]
50
51 def get_browser(self, *a, **kw):
52 kw['verify_ssl_certificates'] = False
53 return super().get_browser(*a, **kw)