![]() |
#1 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2024
Device: Supernote Manta
|
Salon.com Fix
Updated RSS feeds as well as some keep_only_tags and remove_tags.
Code:
#!/usr/bin/env python # vim:fileencoding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from calibre.web.feeds.news import BasicNewsRecipe def classes(classes): q = frozenset(classes.split(' ')) return dict(attrs={ 'class': lambda x: x and frozenset(x.split()).intersection(q)}) class Salon_com(BasicNewsRecipe): title = 'Salon.com' __author__ = 'ebrandon' description = 'Salon.com - Breaking news, opinion, politics, entertainment, sports and culture.' timefmt = ' [%b %d, %Y]' language = 'en' oldest_article = 7 max_articles_per_feed = 100 no_stylesheets = True #auto_cleanup = True #auto_cleanup_keep = '//div[@id="image-id"]' ignore_duplicate_articles = {'title', 'url'} remove_empty_feeds = True keep_only_tags = [ dict(itemprop=['headline', 'description']), classes('article-content title-container article_rail_wrapper cover-wrapper article_img_desc'), ] remove_tags = [ classes('social_comments_app_wrapper related_article layout_template_wrapper writer-container right-rail topic_explore_box'), dict(name=['object', 'link', 'embed', 'iframe', 'meta']), dict(id=['social-left', 'article-footer-wrap']), dict(name='nav', attrs={'class': 'subheading'}), ] remove_attributes = ['lang', 'style'] feeds = [ #('News', 'http://www.salon.com/category/news/feed/rss/'), #('Politics', 'http://www.salon.com/category/politics/feed/rss/'), #('Business', 'http://www.salon.com/category/business/feed/rss/'), #('Technology', 'http://www.salon.com/category/technology/feed/rss/'), #('Innovation', 'http://www.salon.com/category/innovation/feed/rss/'), #('Sustainability', 'http://www.salon.com/category/sustainability/feed/rss/'), #('Entertainment', 'http://www.salon.com/category/entertainment/feed/rss/'), #('Life', 'http://www.salon.com/category/life/feed/rss/'), # ('News and Politics', 'https://www.salon.com/category/news-and-politics/feed'), ('Culture', 'http://www.salon.com/category/culture/feed/'), ('Science & Health', 'https://www.salon.com/category/science-and-health/feed/'), ('Food', 'https://www.salon.com/category/food/feed/'), ('Money', 'https://www.salon.com/category/money/feed/'), ('Life Stories', 'https://www.salon.com/category/life-stories/feed/'), ('Reviews', 'https://www.salon.com/category/reviews/feed/'), ('Top', 'http://www.salon.com/feed/'), ] def get_browser(self, *args, **kwargs): br = BasicNewsRecipe.get_browser(self, *args, **kwargs) br.set_handle_gzip(True) return br calibre_most_common_ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Classics Welcome to the Classics Salon | issybird | Book Clubs | 74 | 09-06-2021 10:50 PM |
Updated Feeds for Salon | sdow1 | Recipes | 4 | 11-29-2011 04:39 AM |
Chit-Chat Le Salon du Livre 2010 | zelda_pinwheel | Forum Français | 42 | 04-04-2010 02:08 PM |
Salon du Livre à Paris | zelda_pinwheel | Lounge français | 24 | 03-18-2009 05:06 PM |