mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Update Spektrum der Wissenschaft
This commit is contained in:
parent
d8fd9b8bc6
commit
2e9259fc3b
@ -1,10 +1,12 @@
|
|||||||
#!/usr/bin/env python2
|
##!/usr/bin/env python2
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
##
|
##
|
||||||
# Written: October 2012 (new coding)
|
# Written: October 2012 (new coding)
|
||||||
# Version: 9.0
|
# Version: 9.0
|
||||||
# Last update: 2019-02-02
|
# Last update: 2018-02-22
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = ''
|
__copyright__ = ''
|
||||||
'''
|
'''
|
||||||
@ -24,7 +26,7 @@ from calibre.web.feeds.recipes import BasicNewsRecipe
|
|||||||
|
|
||||||
class Spektrum(BasicNewsRecipe):
|
class Spektrum(BasicNewsRecipe):
|
||||||
title = u'Spektrum der Wissenschaft'
|
title = u'Spektrum der Wissenschaft'
|
||||||
__author__ = 'Armin Geller, Bratzzo, Rainer Zenz' # Update AGE 2014-02-25, UDe 2019-02-02
|
__author__ = 'Armin Geller, Bratzzo, Rainer Zenz, update epubli'
|
||||||
description = u'German online portal of Spektrum der Wissenschaft'
|
description = u'German online portal of Spektrum der Wissenschaft'
|
||||||
publisher = 'Spektrum der Wissenschaft Verlagsgesellschaft mbH'
|
publisher = 'Spektrum der Wissenschaft Verlagsgesellschaft mbH'
|
||||||
category = 'science news, Germany'
|
category = 'science news, Germany'
|
||||||
@ -59,11 +61,32 @@ class Spektrum(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
classes('hide-for-print content__meta content__author content__video'),
|
classes('hide-for-print'),
|
||||||
|
classes('content__meta'),
|
||||||
|
classes('content__author'),
|
||||||
|
classes('content__video'),
|
||||||
dict(name='div', attrs={'role': 'navigation'}),
|
dict(name='div', attrs={'role': 'navigation'}),
|
||||||
dict(name='span', attrs={'class': 'sr-only'}),
|
dict(name='span', attrs={'class': 'sr-only'}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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[:]:
|
||||||
|
if 'VIDEO' in article.title:
|
||||||
|
feed.articles.remove(article)
|
||||||
|
# Remove articles with 'video','podcast' or 'rezension' in the url.
|
||||||
|
elif 'podcast' in article.url:
|
||||||
|
feed.articles.remove(article)
|
||||||
|
elif 'video' in article.url:
|
||||||
|
feed.articles.remove(article)
|
||||||
|
elif 'rezension' in article.url:
|
||||||
|
feed.articles.remove(article)
|
||||||
|
return feeds
|
||||||
|
|
||||||
def preprocess_html(self, soup, *a):
|
def preprocess_html(self, soup, *a):
|
||||||
for img in soup.findAll('img', attrs={'data-src': True}):
|
for img in soup.findAll('img', attrs={'data-src': True}):
|
||||||
img['src'] = img['data-src']
|
img['src'] = img['data-src']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user