mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
ea62b8b19d
commit
a6840fb462
@ -2,15 +2,17 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2013, Armin Geller'
|
__copyright__ = '2013, Armin Geller'
|
||||||
|
|
||||||
##
|
##
|
||||||
## Written: May 2013 (new coding)
|
# Written: May 2013 (new coding)
|
||||||
## Version: 4.4
|
# Version: 4.4
|
||||||
## Last update: 2020-12-29
|
# Last update: 2020-12-29
|
||||||
##
|
##
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Fetch WirtschaftsWoche Online
|
Fetch WirtschaftsWoche Online
|
||||||
'''
|
'''
|
||||||
|
import re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
||||||
class WirtschaftsWocheOnline(BasicNewsRecipe):
|
class WirtschaftsWocheOnline(BasicNewsRecipe):
|
||||||
title = u'WirtschaftsWoche Online'
|
title = u'WirtschaftsWoche Online'
|
||||||
__author__ = 'Armin Geller' # Update AGE 2013-01-05; 2018-03-01
|
__author__ = 'Armin Geller' # Update AGE 2013-01-05; 2018-03-01
|
||||||
@ -31,14 +33,11 @@ class WirtschaftsWocheOnline(BasicNewsRecipe):
|
|||||||
cover_source = 'https://www.ikiosk.de/shop/epaper/wirtschaftswoche.html'
|
cover_source = 'https://www.ikiosk.de/shop/epaper/wirtschaftswoche.html'
|
||||||
masthead_url = 'http://www.wiwo.de/images/wiwo_logo/5748610/1-formatOriginal.png'
|
masthead_url = 'http://www.wiwo.de/images/wiwo_logo/5748610/1-formatOriginal.png'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
cover_source_soup = self.index_to_soup(self.cover_source)
|
cover_source_soup = self.index_to_soup(self.cover_source)
|
||||||
preview_image_div = cover_source_soup.find(attrs={'class': 'gallery'})
|
preview_image_div = cover_source_soup.find(attrs={'class': 'gallery'})
|
||||||
return preview_image_div.a.img['src']
|
return preview_image_div.a.img['src']
|
||||||
|
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
h1, h2 {font-size: 1.6em; text-align: left}
|
h1, h2 {font-size: 1.6em; text-align: left}
|
||||||
.c-leadtext {font-size: 1em; font-style: italic; font-weight: normal}
|
.c-leadtext {font-size: 1em; font-style: italic; font-weight: normal}
|
||||||
@ -48,19 +47,30 @@ class WirtschaftsWocheOnline(BasicNewsRecipe):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='div', attrs={'class':['o-article__element',
|
dict(
|
||||||
'o-article__content c-richText',
|
name='div',
|
||||||
|
attrs={
|
||||||
|
'class': [
|
||||||
|
'o-article__element', 'o-article__content c-richText',
|
||||||
'o-article__content-element o-article__content-element--richtext'
|
'o-article__content-element o-article__content-element--richtext'
|
||||||
]})
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class':['c-pagination u-flex',
|
dict(
|
||||||
|
name='div',
|
||||||
|
attrs={
|
||||||
|
'class': [
|
||||||
|
'c-pagination u-flex',
|
||||||
'c-standard-article-teaser',
|
'c-standard-article-teaser',
|
||||||
'c-pagination u-flex ajaxify',
|
'c-pagination u-flex ajaxify',
|
||||||
'c-socialshare u-margin-xxl ',
|
'c-socialshare u-margin-xxl ',
|
||||||
'c-list', # AGe 2020-12-29
|
'c-list', # AGe 2020-12-29
|
||||||
]})
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
@ -81,15 +91,12 @@ class WirtschaftsWocheOnline(BasicNewsRecipe):
|
|||||||
# Wandel kostet Milliarden + ': ' + SUV und China sollen Audi wieder nach vorne bringen
|
# Wandel kostet Milliarden + ': ' + SUV und China sollen Audi wieder nach vorne bringen
|
||||||
# https://www.wiwo.de/unternehmen/auto/wandel-kostet-milliarden-suv-und-china-sollen-audi-wieder-nach-vorne-bringen/21069566.html
|
# https://www.wiwo.de/unternehmen/auto/wandel-kostet-milliarden-suv-und-china-sollen-audi-wieder-nach-vorne-bringen/21069566.html
|
||||||
|
|
||||||
# debug:
|
|
||||||
# input: <h2 class="c-headline c-headline--article u-margin-m"><span class="c-overline c-overline--alternate u-uppercase u-letter-spacing u-margin-m c-overline--article">Wandel kostet Milliarden</span> SUV und China sollen Audi wieder nach vorne bringen</h2>
|
|
||||||
# parsed: <h2 class="c-headline c-headline--article u-margin-m"><span class="c-overline c-overline--alternate u-uppercase u-letter-spacing u-margin-m c-overline--article">Wandel kostet Milliarden</span> SUV und China sollen Audi wieder nach vorne bringen</h2>
|
|
||||||
# processed: <h2 class="c-headline"><span class="c-overline">Wandel kostet Milliarden</span> SUV und China sollen Audi wieder nach vorne bringen</h2>
|
|
||||||
# structure: <h2 class="c-headline c-headline--article u-margin-m"><span class="c-overline c-overline--alternate u-uppercase u-letter-spacing u-margin-m c-overline--article">Wandel kostet Milliarden</span> SUV und China sollen Audi wieder nach vorne bringen</h2>
|
|
||||||
# epub: <h2 class="c-headline"><span class="c-overline">Wandel kostet Milliarden</span> SUV und China sollen Audi wieder nach vorne bringen</h2>
|
|
||||||
|
|
||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'(c-overline--article">[^>]*)(</span>)', re.DOTALL|re.IGNORECASE), lambda match: match.group(1) + ': ' + match.group(2)),
|
(
|
||||||
|
re.compile(
|
||||||
|
r'(c-overline--article">[^>]*)(</span>)', re.DOTALL | re.IGNORECASE
|
||||||
|
), lambda match: match.group(1) + ': ' + match.group(2)
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
# /For hegi
|
# /For hegi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user