]> git.phdru.name Git - bookmarks_db.git/blobdiff - parse_html/bkmk_ph_htmlparser.py
Style: Fix flake8 F821 undefined name 'unichr'
[bookmarks_db.git] / parse_html / bkmk_ph_htmlparser.py
index 05ad6584d47ec37f67ae5883181fdc6de5328880..b90618f1856d37a99bd78e7931421aa67e6d45b3 100644 (file)
@@ -47,8 +47,10 @@ class HTMLParser(_HTMLParser):
 
         if (not self.charset) and (http_equiv == "content-type"):
             try:
-                # extract charset from "text/html; foo; charset=UTF-8, bar; baz;"
-                self.charset = content.lower().split('charset=')[1].split(';')[0].split(',')[0]
+                # extract charset from
+                # "text/html; foo; charset=UTF-8, bar; baz;"
+                self.charset = content.lower().split('charset=')[1].\
+                    split(';')[0].split(',')[0]
                 # Remember that the charset was retrieved from
                 # META tag, not from the Content-Type header
                 self.meta_charset = 1
@@ -72,7 +74,9 @@ class HTMLParser(_HTMLParser):
         for attrname, value in attrs:
             if value:
                 value = value.strip()
-                if (attrname == 'rel') and (value.lower() in ('icon', 'shortcut icon')):
+                if (attrname == 'rel') and (
+                        value.lower() in ('icon', 'shortcut icon')
+                ):
                     has_icon = True
                 elif attrname == 'href':
                     href = value
@@ -94,6 +98,7 @@ def parse_html(html_text, charset=None, log=None):
     except (HTMLParseError, HTMLHeadDone):
         pass
 
-    if (parser.title is None) and (parser.refresh is None) and (parser.icon is None):
+    if (parser.title is None) and (parser.refresh is None) \
+            and (parser.icon is None):
         return None
     return parser