mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-13 01:57:00 -05:00
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
from calibre.web.feeds.news import BasicNewsRecipe, classes
|
|
|
|
class DeutscheWelle_en(BasicNewsRecipe):
|
|
title = 'Deutsche Welle'
|
|
__author__ = 'unkn0wn'
|
|
description = 'News from Germany and the world'
|
|
publisher = 'Deutsche Welle'
|
|
language = 'en'
|
|
|
|
oldest_article = 2
|
|
max_articles_per_feed = 50
|
|
no_stylesheets = True
|
|
remove_javascript = True
|
|
remove_empty_feeds = True
|
|
ignore_duplicate_articles = {'title', 'url'}
|
|
remove_attributes = ['height', 'width', 'style']
|
|
|
|
keep_only_tags = [
|
|
dict(name='article')
|
|
]
|
|
|
|
remove_tags = [
|
|
dict(name=['footer', 'source']),
|
|
dict(attrs={'data-tracking-name':'sharing-icons-inline'}),
|
|
classes('kicker advertisement vjs-wrapper')
|
|
]
|
|
|
|
feeds = [
|
|
('World', 'http://rss.dw.de/rdf/rss-en-world'),
|
|
('Germany', 'http://rss.dw.de/rdf/rss-en-ger'),
|
|
('Europe', 'http://rss.dw.de/rdf/rss-en-eu'),
|
|
('Business', 'http://rss.dw.de/rdf/rss-en-bus'),
|
|
('Culture & Lifestyle', 'http://rss.dw.de/rdf/rss-en-cul'),
|
|
('Sports', 'http://rss.dw.de/rdf/rss-en-sports'),
|
|
('Visit Germany', 'http://rss.dw.de/rdf/rss-en-visitgermany'),
|
|
('Asia', 'http://rss.dw.de/rdf/rss-en-asia'),
|
|
('Top Stories', 'http://rss.dw-world.de/rdf/rss-en-top'),
|
|
]
|
|
|
|
def preprocess_html(self, soup):
|
|
for img in soup.findAll('img', srcset=True):
|
|
img['src'] = img['srcset'].split()[6]
|
|
return soup
|