From cb9edb2ccf1d8bbf761ca2186757f47171d6fbd3 Mon Sep 17 00:00:00 2001 From: Paal Braathen Date: Tue, 19 Mar 2013 12:01:43 +0100 Subject: [PATCH] Strip html title --- snurr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snurr.py b/snurr.py index bdd5127..c1d6bb0 100755 --- a/snurr.py +++ b/snurr.py @@ -189,7 +189,8 @@ class IRCActions(): url = urlmatch.group() try: i = urllib2.urlopen(url, timeout=3) - except: + except Exception as e: + log(e) self.bot.msgReply(nick, channel, reply + "Timeout") return statuscode = i.getcode() @@ -203,7 +204,7 @@ class IRCActions(): tree = lxml.html.fromstring(partialhtml) title = tree.find(".//title") if title is not None and title.text is not None: - reply += "[%s]" % title.text + reply += "[%s]" % title.text.strip() # DEBUG if title is None: reply += ""