Debian Codegraph @

recipes/nezavisne_novine.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2013, Darko Miletic <darko.miletic at gmail.com>'
3 '''
4 www.nezavisne.com
5 '''
6 from calibre import strftime
7 from calibre.web.feeds.news import BasicNewsRecipe
8
9
10 class NezavisneNovine(BasicNewsRecipe):
11 title = 'Nezavisne novine'
12 __author__ = 'Darko Miletic'
13 description = 'Nezavisne novine - Najnovije vijesti iz BiH, Srbije, Hrvatske, Crne Gore i svijeta'
14 publisher = 'NIGP "DNN"'
15 category = 'news, politics, Bosnia, Balcans'
16 oldest_article = 2
17 max_articles_per_feed = 200
18 no_stylesheets = True
19 encoding = 'utf8'
20 use_embedded_content = False
21 language = 'sr'
22 remove_empty_feeds = True
23 publication_type = 'newspaper'
24 cover_url = strftime('http://pdf.nezavisne.com/slika/novina/nezavisne_novine.jpg?v=%Y%m%d')
25 masthead_url = 'http://www.nezavisne.com/slika/osnova/nezavisne-novine-logo.gif'
26 extra_css = '''
27 body{font-family: Arial,Helvetica,sans-serif }
28 img{margin-bottom: 0.4em; display:block}
29 '''
30
31 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
32 keep_only_tags = [dict(name='div', attrs={'class': 'vijest'})]
33 remove_tags_after = dict(name='div', attrs={'id': 'wrap'})
34 remove_tags = [dict(name=['meta', 'link', 'iframe', 'object']), dict(name='div', attrs={'id': 'wrap'})]
35 remove_attributes = ['lang', 'xmlns:fb', 'xmlns:og']
36
37 feeds = [
38 ('Novosti', 'http://feeds.feedburner.com/Novosti-NezavisneNovine'),
39 ('Posao', 'http://feeds.feedburner.com/Posao-NezavisneNovine'),
40 ('Sport', 'http://feeds.feedburner.com/Sport-NezavisneNovine'),
41 ('Komentar', 'http://feeds.feedburner.com/Komentari-NezavisneNovine'),
42 ('Umjetnost i zabava', 'http://feeds.feedburner.com/UmjetnostIZabava-NezavisneNovine'),
43 ('Život i stil', 'http://feeds.feedburner.com/ZivotIStil-NezavisneNovine'),
44 ('Auto', 'http://feeds.feedburner.com/Auto-NezavisneNovine'),
45 ('Nauka i tehnologija', 'http://feeds.feedburner.com/NaukaITehnologija-NezavisneNovine'),
46 ]
47
48 def preprocess_html(self, soup):
49 for item in soup.findAll(style=True):
50 del item['style']
51 return soup