mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
News download: Make removal of linked stylesheets a bit more robust
This commit is contained in:
parent
974740539d
commit
55960b33a4
@ -920,8 +920,11 @@ class BasicNewsRecipe(Recipe):
|
|||||||
|
|
||||||
def _postprocess_html(self, soup, first_fetch, job_info):
|
def _postprocess_html(self, soup, first_fetch, job_info):
|
||||||
if self.no_stylesheets:
|
if self.no_stylesheets:
|
||||||
for link in list(soup.findAll('link', type=re.compile('css')))+list(soup.findAll('style')):
|
for link in soup.findAll('link'):
|
||||||
link.extract()
|
if (link.get('type') or '').lower() == 'text/css' and (link.get('rel') or '').lower() == 'stylesheet':
|
||||||
|
link.extract()
|
||||||
|
for style in soup.findAll('style'):
|
||||||
|
soup.extract()
|
||||||
head = soup.find('head')
|
head = soup.find('head')
|
||||||
if not head:
|
if not head:
|
||||||
head = soup.find('body')
|
head = soup.find('body')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user