Debian Codegraph @

recipes/hna.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
3
4 '''
5 Fetch Hessisch Niedersachsische Allgemeine.
6 '''
7
8 from calibre.web.feeds.news import BasicNewsRecipe, classes
9
10
11 class hnaDe(BasicNewsRecipe):
12 title = 'HNA'
13 description = 'local news from Hessen/Germany'
14 __author__ = 'Oliver Niesner'
15 language = 'de'
16 use_embedded_content = False
17 timefmt = ' [%d %b %Y]'
18 max_articles_per_feed = 40
19 no_stylesheets = True
20 remove_javascript = True
21 encoding = 'utf-8'
22 masthead_url = 'https://idcdn.de/west/assets/hna-de/img/logo--cf5324e1.svg'
23
24 def get_cover_url(self):
25 soup = self.index_to_soup('https://epaper.meinehna.de/')
26 if a := soup.find('a', attrs={'class': 'edition-cover__link'}):
27 if citem := a.find('img', src=True):
28 return citem['src']
29
30 keep_only_tags = [dict(name='article', attrs={'class': lambda x: x and 'id-Story' in x.split()})]
31 remove_tags = [
32 classes('id-DonaldBreadcrumb id-StoryElement-interactionBar id-Recommendation id-Comments id-Comments--targetHelper id-StoryElement-inArticleReco')
33 ]
34
35 feeds = [
36 ('hna_soehre', 'http://feeds2.feedburner.com/hna/soehre'),
37 ('hna_kassel', 'http://feeds2.feedburner.com/hna/kassel'),
38 ('hna_KSV', 'http://feeds2.feedburner.com/hna/ksv'),
39 ('hna_kultur', 'http://feeds2.feedburner.com/hna/kultur'),
40 ]