Debian Codegraph @

recipes/njuz_net.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
3 '''
4 njuz.net
5 '''
6 import re
7
8 from calibre.web.feeds.news import BasicNewsRecipe
9
10
11 class NjuzNet(BasicNewsRecipe):
12 title = 'Njuz.net'
13 __author__ = 'Darko Miletic'
14 description = 'Iscasene vesti iz Srbije, regiona i sveta'
15 publisher = 'njuz.net'
16 category = 'news, politics, humor, Serbia'
17 oldest_article = 2
18 max_articles_per_feed = 100
19 no_stylesheets = True
20 use_embedded_content = False
21 encoding = 'utf8'
22 language = 'sr'
23 publication_type = 'newsportal'
24 masthead_url = 'http://www.njuz.net/njuznet.jpg'
25 extra_css = '''
26 @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
27 body{font-family: serif1, serif}
28 .articledescription{font-family: serif1, serif}
29 .wp-caption-text{font-size: x-small}
30 '''
31
32 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
33
34 preprocess_regexps = [(re.compile('\u0110'), lambda match: '\u00d0')] # noqa: RUF039
35
36 keep_only_tags = [dict(attrs={'id': 'entryMeta'}), dict(attrs={'class': 'post'})]
37
38 remove_tags = [dict(name=['embed', 'link', 'base', 'iframe', 'object', 'meta', 'fb:like']), dict(name='div', attrs={'id': 'tagsandcats'})]
39 remove_tags_after = dict(name='div', attrs={'id': 'tagsandcats'})
40 remove_attributes = ['lang']
41 feeds = [('Clanci', 'http://www.njuz.net/feed/')]
42
43 def preprocess_html(self, soup):
44 for item in soup.findAll(style=True):
45 del item['style']
46 for alink in soup.findAll('a'):
47 if alink.string is not None:
48 tstr = alink.string
49 alink.replaceWith(tstr)
50 return soup