News download: Remove the srcset attribute from all images

It is useless and causes unnecessary network activity when reading books
in viewer that support it. Also might be causing iBooks on iOS to refuse
to display the images.
This commit is contained in:
Kovid Goyal 2017-08-30 18:42:41 +05:30
parent 7fd413d392
commit 59bb0f8e55
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -988,6 +988,11 @@ class BasicNewsRecipe(Recipe):
for base in list(soup.findAll(['base', 'iframe', 'canvas', 'embed', for base in list(soup.findAll(['base', 'iframe', 'canvas', 'embed',
'command', 'datalist', 'video', 'audio'])): 'command', 'datalist', 'video', 'audio'])):
base.extract() base.extract()
# srcset causes some viewers, like calibre's to load images from the
# web, and it also possible causes iBooks on iOS to barf, see
# https://bugs.launchpad.net/bugs/1713986
for img in soup.findAll('img', srcset=True):
del img['srcset']
ans = self.postprocess_html(soup, first_fetch) ans = self.postprocess_html(soup, first_fetch)