fix title parsing library reference

This commit is contained in:
iou1name 2021-01-10 17:45:51 -05:00
parent 20199379c2
commit 64953ae402

View File

@ -3,8 +3,8 @@
URL parsing.
"""
import re
import html
from urllib.parse import urlparse
from html.parser import HTMLParser
import requests
@ -85,7 +85,7 @@ def title_auto(bot, trigger):
if res.text.find("<title>") == -1:
continue
title = res.text[res.text.find("<title>")+7:res.text.find("</title>")]
title = HTMLParser().unescape(title)
title = html.unescape(title)
title = title.replace("\n","").strip()
hostname = urlparse(url).hostname
bot.msg(f"[ \x0310{title} \x03] - \x0304{hostname}")