mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
schei? encoding
This commit is contained in:
@@ -152,8 +152,12 @@ def extract_title(url):
|
|||||||
|
|
||||||
if 'text/' != headers['content-type'][:len('text/')]:
|
if 'text/' != headers['content-type'][:len('text/')]:
|
||||||
return 1, headers['content-type']
|
return 1, headers['content-type']
|
||||||
if str != type(html_text):
|
try:
|
||||||
html_text = str(html_text)
|
charset = headers['content-type'].split(';')[1]
|
||||||
|
charset = charset.split("=")[1]
|
||||||
|
html_text = html_text.decode(charset)
|
||||||
|
except KeyError:
|
||||||
|
html_text = str(html_text)
|
||||||
|
|
||||||
result = re.match(r'.*?<title.*?>(.*?)</title>.*?', html_text, re.S | re.M | re.IGNORECASE)
|
result = re.match(r'.*?<title.*?>(.*?)</title>.*?', html_text, re.S | re.M | re.IGNORECASE)
|
||||||
if result:
|
if result:
|
||||||
|
|||||||
Reference in New Issue
Block a user