mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44: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):
|
||||
if self.no_stylesheets:
|
||||
for link in list(soup.findAll('link', type=re.compile('css')))+list(soup.findAll('style')):
|
||||
link.extract()
|
||||
for link in soup.findAll('link'):
|
||||
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')
|
||||
if not head:
|
||||
head = soup.find('body')
|
||||
|
Loading…
x
Reference in New Issue
Block a user