Update New Scientist

This commit is contained in:
Kovid Goyal 2021-04-15 20:22:52 +05:30
parent 98c83d2dec
commit 391e9d3f39
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -64,13 +64,21 @@ class NewScientist(BasicNewsRecipe):
"""
keep_only_tags = [
classes('article-header article-conten')
classes('article-header article__content')
]
remove_tags = [
classes('social__button-container')
]
def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-src': True}):
img['src'] = img['data-src']
for img in soup.findAll('img', attrs={'data-srcset': True}):
img['src'] = img['data-srcset'].split(',')[-1].strip().split()[0]
img['width'] = img['height'] = ''
return soup
def get_article_url(self, article):
ans = BasicNewsRecipe.get_article_url(self, article)
return ans.partition('?')[0]