X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Robots%2Fparse_html_htmlparser.py;h=77021624ff9543a82ebe26cc170398a49f13a6bb;hb=3e5f3edd3d9fb7fcfa2d56ff3794716a4bf4d4cb;hp=cccfe8c7a4b5adab468accbed54287f009f1df72;hpb=38f3645cce7a5875128d788df6631069c761b987;p=bookmarks_db.git diff --git a/Robots/parse_html_htmlparser.py b/Robots/parse_html_htmlparser.py index cccfe8c..7702162 100644 --- a/Robots/parse_html_htmlparser.py +++ b/Robots/parse_html_htmlparser.py @@ -1,7 +1,7 @@ """ HTML Parser - Written by BroytMann. Copyright (C) 1997-2008 PhiloSoft Design + Written by Broytman. Copyright (C) 1997-2010 PhiloSoft Design """ from HTMLParser import HTMLParseError @@ -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): @@ -63,7 +63,7 @@ class HTMLParser(_HTMLParser): for attrname, value in attrs: if value: - value = value.strip().lower() + value = value.strip() if (attrname == 'rel') and (value.lower() in ('icon', 'shortcut icon')): has_icon = True elif attrname == 'href': @@ -90,4 +90,7 @@ def parse_html(filename, charset=None, log=None): except (HTMLParseError, HTMLHeadDone): pass + if parser.title is None: + return None + return parser