From 3b6df3417a54fc8e845a555e30c9d862ba8535bc Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Tue, 22 Oct 2019 16:45:13 +0300 Subject: [PATCH] Fix link tag with missing rel attribute --- nevernote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nevernote.py b/nevernote.py index a7cfe37..9f73c97 100755 --- a/nevernote.py +++ b/nevernote.py @@ -92,7 +92,7 @@ def process_url(url: str, dup_check: bool = False): for link_tag in soup.find_all('link'): link_url = complete_url(link_tag['href'], base_url=url) - if 'stylesheet' in link_tag['rel']: + if link_tag.get('rel') and 'stylesheet' in link_tag['rel']: print('New CSS: %s' % link_url) css_tag = soup.new_tag('style', media='screen', type='text/css') css_tag.string = get_text(link_url)