From a75f371cee200a4238da59ad4694f417a228cf39 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 8 Aug 2010 16:46:55 +0000 Subject: [PATCH] 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 --- Robots/parse_html_beautifulsoup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: -- 2.39.5