From: Oleg Broytman Date: Sun, 8 Aug 2010 16:46:55 +0000 (+0000) Subject: Fixed a bug - parse "HTTP-Equiv" without content. X-Git-Tag: v4.5.3~136 X-Git-Url: https://git.phdru.name/?p=bookmarks_db.git;a=commitdiff_plain;h=a75f371cee200a4238da59ad4694f417a228cf39 Fixed a bug - parse "HTTP-Equiv" without content. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@240 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/parse_html_beautifulsoup.py b/Robots/parse_html_beautifulsoup.py index 47ecbaf..fa5139f 100644 --- a/Robots/parse_html_beautifulsoup.py +++ b/Robots/parse_html_beautifulsoup.py @@ -101,7 +101,11 @@ def parse_html(filename, charset=None, log=None): meta = head.find(_find_contenttype, recursive=False) if meta: try: - __charset = meta.get("content").lower().split('charset=')[1].split(';')[0] + meta_content = meta.get("content") + if meta_content: + __charset = meta_content.lower().split('charset=')[1].split(';')[0] + else: + meta_charset = False except IndexError: # No charset in the META Content-Type meta_charset = False else: