mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-18 04:23:02 -05:00
63 lines
2.1 KiB
Python
63 lines
2.1 KiB
Python
#!/usr/bin/env python
|
|
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = 'Copyright 2011 Starson17'
|
|
'''
|
|
engadget.com
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe, classes
|
|
|
|
|
|
class Engadget(BasicNewsRecipe):
|
|
title = u'Engadget'
|
|
__author__ = 'Starson17, modified by epubli'
|
|
__version__ = 'v2.0'
|
|
__date__ = '14, Sep 2022'
|
|
description = 'Tech news'
|
|
language = 'en'
|
|
oldest_article = 7
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
remove_javascript = True
|
|
remove_empty_feeds = True
|
|
compress_news_images = True
|
|
scale_news_images_to_device = True
|
|
cover_url = 'https://upload.wikimedia.org/wikipedia/commons/b/bb/Engadget-logo.svg'
|
|
|
|
keep_only_tags = [
|
|
dict(name='figure', attrs={'data-component': 'DefaultLede'}),
|
|
dict(name='div', attrs={'data-component': 'ArticleHeader'}),
|
|
dict(
|
|
name='div',
|
|
attrs={'class': ['article-text', 'article-text c-gray-1 no-review']}
|
|
),
|
|
dict(name='figure')
|
|
]
|
|
remove_tags = [
|
|
dict(name='div', attrs={'data-component': 'ArticleAuthorInfo'}),
|
|
classes('notification-upsell-push article-slideshow D(f) rapid-with-clickid athena-button')
|
|
]
|
|
|
|
feeds = [(u'Posts', u'https://www.engadget.com/rss.xml')]
|
|
|
|
def parse_feeds(self):
|
|
# Call parent's method.
|
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
|
# Loop through all feeds.
|
|
for feed in feeds:
|
|
# Loop through all articles in feed.
|
|
for article in feed.articles[:]:
|
|
# Remove articles with '...' in the title.
|
|
if 'best tech deals' in article.title:
|
|
print('Removing:', article.title)
|
|
feed.articles.remove(article)
|
|
elif 'Podcast' in article.title:
|
|
print('Removing:', article.title)
|
|
feed.articles.remove(article)
|
|
elif 'The Morning After' in article.title:
|
|
print('Removing:', article.title)
|
|
feed.articles.remove(article)
|
|
return feeds
|