mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fixed bug : can't parse atlantic's article images
This commit is contained in:
parent
c849f1fc68
commit
614be0d044
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user