From: Christian Heller Date: Fri, 22 Jan 2016 20:25:31 +0000 (+0100) Subject: Be more explicit on URL change on mobile twitter page title hack. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=2623ca2bdf9d23e08c539ae68ad8521291bf2264;p=plomlombot-irc.git Be more explicit on URL change on mobile twitter page title hack. --- diff --git a/plomlombot.py b/plomlombot.py index 0f738f0..a1ef7f8 100755 --- a/plomlombot.py +++ b/plomlombot.py @@ -110,7 +110,7 @@ def lineparser_loop(io, nickname): def url_check(msg): - def handle_url(url): + def handle_url(url, show_url=False): def mobile_twitter_hack(url): re1 = 'https?://(mobile.twitter.com/)[^/]+(/status/)' @@ -121,7 +121,7 @@ def lineparser_loop(io, nickname): m = re.search(re2, url) url = 'https://twitter.com/' + m.group(1) + '/status/' \ + m.group(2) - handle_url(url) + handle_url(url, True) return True try: @@ -136,7 +136,10 @@ def lineparser_loop(io, nickname): return title = bs4.BeautifulSoup(r.text).title if title: - notice("PAGE TITLE: " + title.string.strip()) + prefix = "PAGE TITLE: " + if show_url: + prefix = "PAGE TITLE FOR <" + url + ">: " + notice(prefix + title.string.strip()) else: notice("PAGE HAS NO TITLE TAG")