mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News download: Remove all link and meta tags
These can have various ill effects
This commit is contained in:
parent
72bfb00300
commit
bb71434797
@ -1007,14 +1007,15 @@ class BasicNewsRecipe(Recipe):
|
|||||||
for o in soup.findAll(onload=True):
|
for o in soup.findAll(onload=True):
|
||||||
del o['onload']
|
del o['onload']
|
||||||
|
|
||||||
for script in list(soup.findAll('noscript')):
|
|
||||||
script.extract()
|
|
||||||
for attr in self.remove_attributes:
|
for attr in self.remove_attributes:
|
||||||
for x in soup.findAll(attrs={attr:True}):
|
for x in soup.findAll(attrs={attr:True}):
|
||||||
del x[attr]
|
del x[attr]
|
||||||
for base in list(soup.findAll(['base', 'iframe', 'canvas', 'embed',
|
for bad_tag in list(soup.findAll(['base', 'iframe', 'canvas', 'embed',
|
||||||
'command', 'datalist', 'video', 'audio'])):
|
'command', 'datalist', 'video', 'audio', 'noscript', 'link', 'meta'])):
|
||||||
base.extract()
|
# link tags can be used for preloading causing network activity in
|
||||||
|
# calibre viewer. meta tags can do all sorts of crazy things,
|
||||||
|
# including http-equiv refresh, viewport shenanigans, etc.
|
||||||
|
bad_tag.extract()
|
||||||
# srcset causes some viewers, like calibre's to load images from the
|
# srcset causes some viewers, like calibre's to load images from the
|
||||||
# web, and it also possible causes iBooks on iOS to barf, see
|
# web, and it also possible causes iBooks on iOS to barf, see
|
||||||
# https://bugs.launchpad.net/bugs/1713986
|
# https://bugs.launchpad.net/bugs/1713986
|
||||||
|
Loading…
x
Reference in New Issue
Block a user