diff --git a/recipes/icons/sonar21.png b/recipes/icons/sonar21.png new file mode 100644 index 0000000000..cf89748e32 Binary files /dev/null and b/recipes/icons/sonar21.png differ diff --git a/recipes/sonar21.recipe b/recipes/sonar21.recipe new file mode 100644 index 0000000000..3750b1a065 --- /dev/null +++ b/recipes/sonar21.recipe @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# vim:fileencoding=utf-8 +from calibre.web.feeds.news import BasicNewsRecipe, classes + + +class Sonar21(BasicNewsRecipe): + title = 'Sonar21' + __author__ = 'unkn0wn' + oldest_article = 7 + language = 'en_US' + max_articles_per_feed = 100 + use_embedded_content = False + masthead_url = 'https://sonar21.com/wp-content/uploads/2024/10/logo_999999_720x216.png' + cover_url = 'https://sonar21.com/wp-content/uploads/2024/09/sonar21_backplate_vertical.jpg' + encoding = 'utf-8' + browser_type = 'webengine' + no_stylesheets = True + remove_attributes = ['style', 'height', 'width'] + extra_css = '.entry-meta, .wp-element-caption, .wp-block-image { font-size: small; }' + + keep_only_tags = [classes('entry-header entry-content')] + + remove_tags = [ + dict(name=['iframe', 'svg']), + classes('addtoany_share_save_container wpd-avatar'), + ] + + recipe_specific_options = { + 'days': { + 'short': 'Oldest article to download from this news source. In days ', + 'long': 'For example, 0.5, gives you articles from the past 12 hours', + 'default': str(oldest_article), + }, + } + + def __init__(self, *args, **kwargs): + BasicNewsRecipe.__init__(self, *args, **kwargs) + d = self.recipe_specific_options.get('days') + if d and isinstance(d, str): + self.oldest_article = float(d) + + feeds = ['https://sonar21.com/feed']