Debian Codegraph @

recipes/kurier.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3 from __future__ import absolute_import, division, print_function, unicode_literals
4
5 __license__ = 'GPL v3'
6 __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
7
8 '''
9 kurier.at
10 '''
11
12 import re
13
14 from calibre.web.feeds.news import BasicNewsRecipe
15
16
17 class Kurier(BasicNewsRecipe):
18 title = 'Kurier'
19 __author__ = 'Darko Miletic'
20 description = 'News from Austria'
21 publisher = 'KURIER'
22 category = 'news, politics, Austria'
23 oldest_article = 2
24 max_articles_per_feed = 100
25 timeout = 30
26 no_stylesheets = True
27 use_embedded_content = False
28 language = 'de_AT'
29 remove_empty_feeds = True
30 publication_type = 'newspaper'
31
32 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
33
34 feeds = [
35 ('Politik', 'http://kurier.at/politik/xml/rss'),
36 ('Wirtschaft', 'http://kurier.at/wirtschaft/xml/rss'),
37 ('Chronik', 'http://kurier.at/chronik/xml/rss'),
38 ('Kultur', 'http://kurier.at/kultur/xml/rss'),
39 ('Leben', 'http://kurier.at/leben/xml/rss'),
40 ('Menschen', 'http://kurier.at/menschen/xml/rss'),
41 ('Sport', 'http://kurier.at/sport/xml/rss'),
42 ]
43
44 keep_only_tags = [dict(name='article', attrs={'class': re.compile(r'main-article')})]
45
46 remove_tags = [
47 dict(name='div', attrs={'class': 'social-media-container'}),
48 dict(name='section', attrs={'class': 'tags'}),
49 dict(name='section', attrs={'class': re.compile(r'comment-box')}),
50 dict(name='section', attrs={'class': re.compile(r'related-content')}),
51 dict(name='section', attrs={'class': re.compile(r'article-slider')}),
52 dict(name='section', attrs={'class': re.compile(r'commentcontainer')}),
53 dict(name='blockquote'),
54 ]
55
56 remove_attributes = ['width', 'height']
57
58 def preprocess_html(self, soup):
59 for item in soup.findAll(style=True):
60 del item['style']
61 return self.adeify_images(soup)