Debian Codegraph @

recipes/sonar21.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3 from calibre.web.feeds.news import BasicNewsRecipe, classes
4
5
6 class Sonar21(BasicNewsRecipe):
7 title = 'Sonar21'
8 __author__ = 'unkn0wn'
9 oldest_article = 7
10 language = 'en_US'
11 max_articles_per_feed = 100
12 use_embedded_content = False
13 masthead_url = 'https://sonar21.com/wp-content/uploads/2024/10/logo_999999_720x216.png'
14 cover_url = 'https://sonar21.com/wp-content/uploads/2024/09/sonar21_backplate_vertical.jpg'
15 encoding = 'utf-8'
16 browser_type = 'webengine'
17 no_stylesheets = True
18 remove_attributes = ['style', 'height', 'width']
19 extra_css = '.entry-meta, .wp-element-caption, .wp-block-image { font-size: small; }'
20
21 keep_only_tags = [classes('entry-header entry-content')]
22
23 remove_tags = [
24 dict(name=['iframe', 'svg']),
25 classes('addtoany_share_save_container wpd-avatar'),
26 ]
27
28 recipe_specific_options = {
29 'days': {
30 'short': 'Oldest article to download from this news source. In days ',
31 'long': 'For example, 0.5, gives you articles from the past 12 hours',
32 'default': str(oldest_article),
33 },
34 }
35
36 def __init__(self, *args, **kwargs):
37 BasicNewsRecipe.__init__(self, *args, **kwargs)
38 d = self.recipe_specific_options.get('days')
39 if d and isinstance(d, str):
40 self.oldest_article = float(d)
41
42 feeds = ['https://sonar21.com/feed']