From 76667548a9737ca6664fe4391d045e3b6f0d4ffd Mon Sep 17 00:00:00 2001 From: Tatu Wikman Date: Thu, 18 Jun 2020 14:17:58 +0300 Subject: [PATCH] make sure title exists before trying to use it, fixes #83 --- modules/url.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/url.py b/modules/url.py index 0d1d7cd..7171b21 100644 --- a/modules/url.py +++ b/modules/url.py @@ -114,7 +114,8 @@ class MatrixModule(BotModule): # try parse and get the title try: soup = BeautifulSoup(r.text, "html.parser") - title = soup.title.string.strip() + if soup.head and soup.head.title: + title = soup.head.title.string.strip() descr_tag = soup.find("meta", attrs={"name": "description"}) if descr_tag: description = descr_tag.get("content", None)