Catch exceptions in modules/title.py

This commit is contained in:
jesopo 2018-10-19 10:31:45 +01:00
parent 6bcfcb60ea
commit 87fc3cda55

View file

@ -20,9 +20,16 @@ class Module(ModuleManager.BaseModule):
url = re.search(REGEX_URL, url.message).group(0)
if not url:
raise utils.EventError("No URL provided/found.")
soup = utils.http.get_url(url, soup=True)
soup = None
try:
soup = utils.http.get_url(url, soup=True)
except:
pass
if not soup:
raise utils.EventError("Failed to get URL.")
title = soup.title
if title:
title = title.text.replace("\n", " ").replace("\r", ""