mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Update The Economist
This commit is contained in:
parent
7f0f5d114c
commit
ef6fd9cf42
@ -83,7 +83,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
),
|
),
|
||||||
dict(attrs={
|
dict(attrs={
|
||||||
'class': lambda x: x and 'blog-post__siblings-list-aside' in x.split()}),
|
'class': lambda x: x and 'blog-post__siblings-list-aside' in x.split()}),
|
||||||
classes('share-links-header teaser--wrapped latest-updates-panel__container latest-updates-panel__article-link blog-post__section')
|
classes('share-links-header teaser--wrapped latest-updates-panel__container latest-updates-panel__article-link blog-post__section newsletter-form')
|
||||||
]
|
]
|
||||||
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
@ -170,9 +170,9 @@ class Economist(BasicNewsRecipe):
|
|||||||
img = soup.find(attrs={'srcset': True, 'class': lambda x: x and 'print-edition__cover-widget__image' in x.split()})
|
img = soup.find(attrs={'srcset': True, 'class': lambda x: x and 'print-edition__cover-widget__image' in x.split()})
|
||||||
if img is not None:
|
if img is not None:
|
||||||
for part in img['srcset'].split():
|
for part in img['srcset'].split():
|
||||||
if part.startswith('//'):
|
if part.startswith('/'):
|
||||||
part = part.replace('200-width', '640-width')
|
part = part.replace('200-width', '640-width')
|
||||||
self.cover_url = 'https:' + part
|
self.cover_url = 'https://www.economist.com' + part
|
||||||
self.log('Got cover:', self.cover_url)
|
self.log('Got cover:', self.cover_url)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
),
|
),
|
||||||
dict(attrs={
|
dict(attrs={
|
||||||
'class': lambda x: x and 'blog-post__siblings-list-aside' in x.split()}),
|
'class': lambda x: x and 'blog-post__siblings-list-aside' in x.split()}),
|
||||||
classes('share-links-header teaser--wrapped latest-updates-panel__container latest-updates-panel__article-link blog-post__section')
|
classes('share-links-header teaser--wrapped latest-updates-panel__container latest-updates-panel__article-link blog-post__section newsletter-form')
|
||||||
]
|
]
|
||||||
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
keep_only_tags = [dict(name='article', id=lambda x: not x)]
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
@ -170,9 +170,9 @@ class Economist(BasicNewsRecipe):
|
|||||||
img = soup.find(attrs={'srcset': True, 'class': lambda x: x and 'print-edition__cover-widget__image' in x.split()})
|
img = soup.find(attrs={'srcset': True, 'class': lambda x: x and 'print-edition__cover-widget__image' in x.split()})
|
||||||
if img is not None:
|
if img is not None:
|
||||||
for part in img['srcset'].split():
|
for part in img['srcset'].split():
|
||||||
if part.startswith('//'):
|
if part.startswith('/'):
|
||||||
part = part.replace('200-width', '640-width')
|
part = part.replace('200-width', '640-width')
|
||||||
self.cover_url = 'https:' + part
|
self.cover_url = 'https://www.economist.com' + part
|
||||||
self.log('Got cover:', self.cover_url)
|
self.log('Got cover:', self.cover_url)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user