Debian Codegraph @

recipes/information_dk.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
3 '''
4 information.dk
5 '''
6
7 import re
8
9 from calibre.web.feeds.news import BasicNewsRecipe
10
11
12 class Information_dk(BasicNewsRecipe):
13 title = 'Information - Denmark'
14 __author__ = 'Darko Miletic'
15 description = 'News from Denmark'
16 publisher = 'information.dk'
17 category = 'news, politics, Denmark'
18 oldest_article = 2
19 max_articles_per_feed = 100
20 no_stylesheets = True
21 remove_empty_feeds = True
22 use_embedded_content = False
23 encoding = 'utf8'
24 language = 'da'
25
26 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
27
28 feeds = [
29 ('Nyheder', 'https://www.information.dk/feed'),
30 ('Politik', 'https://www.information.dk/emne/politik/feed'),
31 ('Indland', 'https://www.information.dk/indland/feed'),
32 ('Udland', 'https://www.information.dk/udland/feed'),
33 ('Debat', 'https://www.information.dk/debat/feed'),
34 ('Kunst og kultur', 'https://www.information.dk/kultur/feed'),
35 ('Literatur', 'https://www.information.dk/litteratur/feed'),
36 ('Film', 'https://www.information.dk/emne/film/feed'),
37 ('Kunst', 'https://www.information.dk/emne/kunst/feed'),
38 ]
39
40 keep_only_tags = [dict(name='article', attrs={}), dict(name='div', attrs={'class': 'field-name-body'})]
41 remove_tags_before = dict(name='h1', attrs={'class': 'print-title'})
42 remove_tags_after = dict(name='div', attrs={'class': 'print-footer'})
43
44 field_name_best_from_inf = '^.*?field-name-best-from-inf.*?$'
45 related_stuff = '^.*?related-stuff.*?$'
46 view_iv_seneste = '^.*?view-iv-seneste.*?$'
47 view_iv_news_queue = '^.*?view-iv-news-queue.*?$'
48 view_footer = '^.*?view-footer.*?$'
49 field_name_recommendations = '^.*?field-name-recommendations.*?$'
50 field_name_comments_label = '^.*?field-name-comments-label.*?$'
51 field_name_no_comments = '^.?field-name-no-comments.*?$'
52 comment = '^.*?comment.*?$'
53
54 remove_tags = [
55 dict(name=['object', 'link']),
56 dict(name='div', attrs={'id': 'node-article-full-group-date'}),
57 dict(name='div', attrs={'id': 'node-article-full-group-right'}),
58 dict(name='div', attrs={'id': 'node-article-non-subscriber-full-group-date'}),
59 dict(name='div', attrs={'id': 'node-article-non-subscriber-full-group-right'}),
60 dict(name='div', attrs={'class': re.compile(field_name_best_from_inf, re.IGNORECASE)}),
61 dict(name='div', attrs={'class': re.compile(related_stuff, re.IGNORECASE)}),
62 dict(name='div', attrs={'class': re.compile(view_iv_seneste, re.IGNORECASE)}),
63 dict(name='div', attrs={'class': re.compile(view_iv_news_queue, re.IGNORECASE)}),
64 dict(name='div', attrs={'class': re.compile(view_footer, re.IGNORECASE)}),
65 dict(name='div', attrs={'class': re.compile(field_name_recommendations, re.IGNORECASE)}),
66 dict(name='div', attrs={'class': re.compile(field_name_comments_label, re.IGNORECASE)}),
67 dict(name='div', attrs={'class': re.compile(field_name_no_comments, re.IGNORECASE)}),
68 dict(name='article', attrs={'class': re.compile(comment, re.IGNORECASE)}),
69 dict(name='h2', attrs={'class': 'pane-title'}),
70 dict(name='div', attrs={'id': 'comments'}),
71 ]