X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Robots%2Fbkmk_robot_base.py;h=f32e1b304d45aab959b047d51db4140241b90633;hb=e69ee847224026d24684847d19d178f5b0db9309;hp=1d762d94d1713f951d583f120d658f2f9f8d17dd;hpb=03d2e88efc7b2046a404679a36a8a65d6faae98c;p=bookmarks_db.git diff --git a/Robots/bkmk_robot_base.py b/Robots/bkmk_robot_base.py index 1d762d9..f32e1b3 100644 --- a/Robots/bkmk_robot_base.py +++ b/Robots/bkmk_robot_base.py @@ -144,13 +144,12 @@ class robot_base(Robot): except (ValueError, IndexError): charset = None self.log(" no charset in Content-Type header") + is_html = False for ctype in ("text/html", "application/xhtml+xml"): if content_type.startswith(ctype): - html = True + is_html = True break - else: - html = False - if html: + if content and is_html: parser = parse_html(content, charset, self.log) if parser: bookmark.real_title = parser.title @@ -247,6 +246,10 @@ class robot_base(Robot): % (url, timeout) ) + if not content: + self.log(" empty response, no content") + if not is_html: + self.log(" not html") except KeyError as key: self.log(" no header: %s" % key)