]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/parse_html_htmlparser.py
Title (and refresh) can be None.
[bookmarks_db.git] / Robots / parse_html_htmlparser.py
index 30911dda7012b0ad9aa273692cc766d3eb5cd775..493db3e87fc9388cfaf04e3819128089549b875e 100644 (file)
@@ -16,8 +16,8 @@ class HTMLParser(_HTMLParser):
       _HTMLParser.__init__(self)
       self.charset = charset
       self.meta_charset = 0
-      self.title = ''
-      self.refresh = ''
+      self.title = None
+      self.refresh = None
       self.icon = None
 
    def end_head(self):
@@ -38,8 +38,8 @@ class HTMLParser(_HTMLParser):
 
       if (not self.charset) and (http_equiv == "content-type"):
          try:
-            # extract charset from "text/html; foo; charset=UTF-8; bar;"
-            self.charset = content.lower().split('charset=')[1].split(';')[0]
+            # extract charset from "text/html; foo; charset=UTF-8, bar; baz;"
+            self.charset = content.lower().split('charset=')[1].split(';')[0].split(',')[0]
             self.meta_charset = 1 # Remember that the charset was retrieved from
                                   # META tag, not from the Content-Type header
          except IndexError: