From 59bb0f8e55220813e146f28b7f904557e47dd18c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 30 Aug 2017 18:42:41 +0530 Subject: [PATCH] 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. --- src/calibre/web/feeds/news.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index a7c814e533..378e97058b 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -988,6 +988,11 @@ class BasicNewsRecipe(Recipe): for base in list(soup.findAll(['base', 'iframe', 'canvas', 'embed', 'command', 'datalist', 'video', 'audio'])): 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)