X-Git-Url: https://plomlompom.com/repos/?p=plomlombot-irc.git;a=blobdiff_plain;f=plomlombot.py;h=a1ef7f8c3e2b60f9a61a4c2db1e8485e1b5ec5ae;hp=0f738f0003e5c8dca674e97b2df0bde7c9b9c460;hb=2623ca2bdf9d23e08c539ae68ad8521291bf2264;hpb=057a62fe23a19af870b72684e50755c4e93821fc;ds=sidebyside 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")