Debian Codegraph @

recipes/karlsruhe.recipe

raw
1 import re
2
3 from calibre.web.feeds.news import BasicNewsRecipe
4
5
6 class KANewsRecipe(BasicNewsRecipe):
7 title = 'KA-News.de'
8 description = 'Nachrichten aus Karlsruhe, Deutschland und der Welt.'
9 __author__ = 'tfeld'
10 lang = 'de'
11 language = 'de'
12 no_stylesheets = True
13
14 oldest_article = 7
15 max_articles_per_feed = 100
16
17 feeds = [
18 ('News aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/karlsruhe.xml'),
19 ('Kulturnachrichten aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/kultur.xml'),
20 ('Durlach: News aus Durlach', 'http://www.ka-news.de/storage/rss/rss/durlach.xml'),
21 ('Stutensee: News aus Stutensee Blankenloch, Büchig, Friedrichstal, Staffort, Spöck', 'http://www.ka-news.de/storage/rss/rss/stutensee.xml'),
22 ('Bruchsal: News aus Bruchsal', 'http://www.ka-news.de/storage/rss/rss/bruchsal.xml'),
23 ('Wirtschaftsnews aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/wirtschaft.xml'),
24 ('ka-news.de - Sport', 'http://www.ka-news.de/storage/rss/rss/sport.xml'),
25 ('KSC-News - News rund um den KSC', 'http://www.ka-news.de/storage/rss/rss/ksc.xml'),
26 ('ka-news.de - BG Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/basketball.xml'),
27 ]
28
29 preprocess_regexps = [
30 (re.compile(r'width:[0-9]*?px', re.DOTALL | re.IGNORECASE), lambda match: ''),
31 ]
32
33 remove_tags_before = dict(id='artdetail_ueberschrift')
34 remove_tags_after = dict(id='artdetail_unterzeile')
35 remove_tags = [
36 dict(name=['div'], attrs={'class': 'lbx_table'}),
37 dict(name=['div'], attrs={'class': 'lk_zumthema'}),
38 dict(name=['div'], attrs={'class': 'lk_thumb'}),
39 dict(name=['div'], attrs={'class': 'lk_trenner'}),
40 dict(name=['div'], attrs={'class': 'lupen_container'}),
41 dict(name=['script']),
42 dict(name=['span'], attrs={'style': 'display:none;'}),
43 dict(name=['span'], attrs={'class': 'comm_info'}),
44 dict(name=['h3'], attrs={'id': 'artdetail_unterzeile'}),
45 ]
46
47 # removing style attribute _after_ removing specific tags above
48 remove_attributes = ['width', 'height', 'style']
49
50 extra_css = '''
51 h1{ font-size:large; font-weight:bold; }
52 h2{ font-size:medium; font-weight:bold; }
53 '''
54
55 def get_cover_url(self):
56 return 'http://www.ka-news.de/storage/scl/techkanews/logos/434447_m1t1w250q75s1v29681_ka-news-Logo_mit_Schatten_transparent.png'