finally:
infile.close()
- _charset = root.originalEncoding
try:
- title = root.html.head.title.string.encode(_charset)
+ head = root.html.head
except AttributeError:
return None
- meta = root.html.head.find(_find_refresh, recursive=False)
+ _charset = root.originalEncoding
+ try:
+ title = head.title.string.encode(_charset)
+ except AttributeError:
+ return '' # HEAD but no TITLE
+
+ meta = head.find(_find_refresh, recursive=False)
if meta:
refresh = meta.get("content")
else:
refresh = None
- meta = root.html.head.find(_find_icon, recursive=False)
+ meta = head.find(_find_icon, recursive=False)
if meta:
icon = meta.get("href")
else: