]> git.phdru.name Git - bookmarks_db.git/commitdiff
Some sites put TITLE in HTML without HEAD.
authorOleg Broytman <phd@phdru.name>
Tue, 8 Jan 2008 15:47:01 +0000 (15:47 +0000)
committerOleg Broytman <phd@phdru.name>
Tue, 8 Jan 2008 15:47:01 +0000 (15:47 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@157 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/parse_html_beautifulsoup.py

index 730e263423d9fd25beb943966dc226718924ce12..209486c4054f015a179d4469ccaa5adc3f8bbe8f 100644 (file)
@@ -63,6 +63,9 @@ def parse_html(filename, charset=None):
    except AttributeError:
       return None
 
+   if head is None:
+      head = root.html # Some sites put TITLE in HTML without HEAD
+
    _charset = root.originalEncoding
    try:
       title = head.title.string.encode(_charset)