Debian Codegraph @

recipes/rmf24_opinie.recipe

raw
1 #!/usr/bin/env python
2
3 __license__ = 'GPL v3'
4 __copyright__ = '2010, Tomasz Dlugosz <[email protected]>'
5 '''
6 rmf24.pl
7 '''
8
9 import re
10
11 from calibre.web.feeds.news import BasicNewsRecipe
12
13
14 class RMF24_opinie(BasicNewsRecipe):
15 title = 'Rmf24.pl - Opinie'
16 description = 'Blogi, wywiady i komentarze ze strony rmf24.pl'
17 language = 'pl'
18 oldest_article = 7
19 max_articles_per_feed = 100
20 __author__ = 'Tomasz D\u0142ugosz'
21 no_stylesheets = True
22 remove_javascript = True
23 remove_empty_feeds = True
24
25 feeds = [
26 ('Blogi', 'http://www.rmf24.pl/opinie/blogi/feed'),
27 ('Kontrwywiad', 'http://www.rmf24.pl/opinie/wywiady/kontrwywiad/feed'),
28 ('Przes\u0142uchanie', 'http://www.rmf24.pl/opinie/wywiady/przesluchanie/feed'),
29 ('Komentarze', 'http://www.rmf24.pl/opinie/komentarze/feed'),
30 ]
31
32 keep_only_tags = [dict(name='header', attrs={'class': 'article-header'}), dict(name='div', attrs={'class': 'article-container'})]
33
34 remove_tags = [dict(name='div', attrs={'id': 'ReklamaMobile'})]
35
36 extra_css = '''
37 h1 { font-size: 1.2em; }
38 '''
39
40 # thanks to Kovid Goyal
41 def get_article_url(self, article):
42 link = article.get('link')
43 if '/audio,aId' not in link:
44 return link
45
46 preprocess_regexps = [
47 (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1])
48 for i in [
49 (r'<h2>Zdj.cie</h2>', lambda match: ''),
50 (
51 r'embed embed(Left|Right|Center) articleEmbed(Audio|Wideo articleEmbedVideo|ArticleFull|ArticleTitle|ArticleListTitle|AlbumHorizontal)">',
52 lambda match: 'REMOVE">',
53 ), # noqa: E501
54 (r'<a href="http://www.facebook.com/pages/RMF24pl/.*?>RMF24.pl</a> on Facebook</div>', lambda match: '</div>'),
55 ]
56 ]