Debian Codegraph @

recipes/rmf24_fakty.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(BasicNewsRecipe):
15 title = 'Rmf24.pl - Fakty'
16 description = 'Fakty 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
24 feeds = [('Kraj', 'http://www.rmf24.pl/fakty/polska/feed'), ('\u015awiat', 'http://www.rmf24.pl/fakty/swiat/feed')]
25
26 keep_only_tags = [dict(name='header', attrs={'class': 'article-header'}), dict(name='div', attrs={'class': 'article-container'})]
27
28 remove_tags = [dict(name='div', attrs={'id': 'ReklamaMobile'}), dict(name='img', attrs={'class': 'img-responsive hidden-lg hidden-md hidden-sm'})]
29
30 extra_css = '''
31 h1 { font-size: 1.2em; }
32 '''
33 preprocess_regexps = [
34 (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1])
35 for i in [
36 (r'<h2>Zdj.cie</h2>', lambda match: ''),
37 (r'<a href="http://www.facebook.com/pages/RMF24pl/.*?>RMF24.pl</a> on Facebook</div>', lambda match: '</div>'),
38 ]
39 ]