X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=Robots%2Fparse_html.py;h=b30c66458eaa32960b5badce9bc849a2082213d7;hb=0274654a95196ee2b70720b4708a4dd76107a2ba;hp=90b777b4e97a2754c2bfc33d2e4f9ff966f6d0b5;hpb=89da3d3a6fef5ce76d0bce4904c134a6e7f5fc6a;p=bookmarks_db.git diff --git a/Robots/parse_html.py b/Robots/parse_html.py index 90b777b..b30c664 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -71,15 +71,13 @@ class HTMLParser(_HTMLParser): for attrname, value in attrs: if value: value = value.strip().lower() - if (attrname == 'rel') and (value in ('icon', 'shortcut icon')): + if (attrname == 'rel') and (value.lower() in ('icon', 'shortcut icon')): has_icon = True elif attrname == 'href': href = value if has_icon: self.icon = href - else: - self.icon = None import re @@ -147,6 +145,7 @@ def parse_html(filename, charset=None, log=None): if __name__ == '__main__': + import sys parser = parse_html(sys.argv[1]) print parser.charset print parser.title