Fixed a bug if the <head> isn't in the first 1kb.

This commit is contained in:
Kevin Steck
2013-10-08 16:34:26 -04:00
committed by Neil Williams
parent 4f1a5fdf19
commit 847ee8ffec

View File

@@ -225,7 +225,7 @@ def get_title(url):
def extract_title(data):
"""Tries to extract the value of the title element from a string of HTML"""
bs = BeautifulSoup(data, convertEntities=BeautifulSoup.HTML_ENTITIES)
if not bs:
if not bs or not bs.html.head:
return
title_bs = bs.html.head.title