home · contact · privacy
Strip whitespace start/end from page title.
[plomlombot-irc.git] / plomlombot.py
index 3e4734fa2ec2403aa093768623e1ca9b189d5cd8..2b59a0b9a5bc5331c21988dbc8997b8dbefefff6 100755 (executable)
@@ -114,12 +114,13 @@ def lineparser_loop(io, nickname):
                     r = requests.get(url, timeout=15)
                 except (requests.exceptions.TooManyRedirects,
                         requests.exceptions.ConnectionError,
+                        requests.exceptions.InvalidURL,
                         requests.exceptions.InvalidSchema) as error:
                     notice("TROUBLE FOLLOWING URL: " + str(error))
                     continue
                 title = bs4.BeautifulSoup(r.text).title
                 if title:
-                    notice("PAGE TITLE FOR URL: " + title.string)
+                    notice("PAGE TITLE FOR URL: " + title.string.strip())
                 else:
                     notice("PAGE HAS NO TITLE TAG")