X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=plomlombot.py;h=e1ec06a4abf82f51a6a60a3a70c3673fe5bf53c5;hb=92520ed306f6e61d93b1c5b31cccb889002cdd7f;hp=0f738f0003e5c8dca674e97b2df0bde7c9b9c460;hpb=057a62fe23a19af870b72684e50755c4e93821fc;p=plomlombot-irc.git
diff --git a/plomlombot.py b/plomlombot.py
index 0f738f0..e1ec06a 100755
--- a/plomlombot.py
+++ b/plomlombot.py
@@ -110,18 +110,19 @@ 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/)'
- re2 = 'https?://mobile.twitter.com/([^/]+)/status/([^\?]+)'
+ re2 = 'https?://mobile.twitter.com/([^/]+)/status/' \
+ + '([^\?/]+)'
m = re.search(re1, url)
if m and m.group(1) == 'mobile.twitter.com/' \
and m.group(2) == '/status/':
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 +137,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")