Update The Economist

This commit is contained in:
Kovid Goyal 2018-02-20 06:59:09 +05:30
parent 7f0f5d114c
commit ef6fd9cf42
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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