Merge pull request #89 from tswfi/fix_url_none
make sure title exists before trying to use it, fixes #83
This commit is contained in:
commit
69c18070f7
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue