mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News fetching: Fix a regression that broke removal of attributes/javascript/srcset because of bugs in the new BeautifulSoup
This commit is contained in:
parent
7270eaa91f
commit
bc661a812d
@ -972,6 +972,9 @@ class BasicNewsRecipe(Recipe):
|
||||
extra_css=self.get_extra_css() or '')
|
||||
elem = BeautifulSoup(templ.render(doctype='xhtml').decode('utf-8')).find('div')
|
||||
body.insert(0, elem)
|
||||
# This is needed because otherwise inserting elements into
|
||||
# the soup breaks find()
|
||||
soup = BeautifulSoup(soup.decode_contents())
|
||||
if self.remove_javascript:
|
||||
for script in list(soup.findAll('script')):
|
||||
script.extract()
|
||||
|
Loading…
x
Reference in New Issue
Block a user