This commit is contained in:
Kovid Goyal 2020-11-27 10:15:52 +05:30
commit 5a69e8841c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 2 deletions

View File

@ -87,7 +87,12 @@ class TheAtlantic(BasicNewsRecipe):
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-srcset': True}): for img in soup.findAll('img', attrs={'data-srcset': True}):
img['src'] = img['data-srcset'].split()[0] #img['src'] = img['data-srcset'].split()[0]
data_srcset = img['data-srcset']
if ',' in data_srcset:
img['src'] = data_srcset.split(',')[0]
else:
img['src'] = data_srcset.split()[0]
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']
return soup return soup

View File

@ -87,7 +87,12 @@ class TheAtlantic(BasicNewsRecipe):
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-srcset': True}): for img in soup.findAll('img', attrs={'data-srcset': True}):
img['src'] = img['data-srcset'].split()[0] #img['src'] = img['data-srcset'].split()[0]
data_srcset = img['data-srcset']
if ',' in data_srcset:
img['src'] = data_srcset.split(',')[0]
else:
img['src'] = data_srcset.split()[0]
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']
return soup return soup