git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@265
fdd5c36f-1aea-0310-aeeb-
c58d7e2b6c23
html_tree = HTML5Parser().parse(fp, charset)
fp.close()
+ if not html_tree.childNodes:
+ return None
+
html = html_tree.childNodes[-1]
for node in html.childNodes:
if node.name == 'head':
for node in head.childNodes:
if node.name == 'title':
- title = node.childNodes[0].value
- break
+ if node.childNodes:
+ title = node.childNodes[0].value
+ break
+ else:
+ title = ''
if title and (charset or meta_charset):
title = title.encode(charset or meta_charset)