home
·
contact
·
privacy
projects
/
plomlombot-irc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
057a62f
)
Be more explicit on URL change on mobile twitter page title hack.
author
Christian Heller
<c.heller@plomlompom.de>
Fri, 22 Jan 2016 20:25:31 +0000
(21:25 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Fri, 22 Jan 2016 20:25:31 +0000
(21:25 +0100)
plomlombot.py
patch
|
blob
|
history
diff --git
a/plomlombot.py
b/plomlombot.py
index 0f738f0003e5c8dca674e97b2df0bde7c9b9c460..a1ef7f8c3e2b60f9a61a4c2db1e8485e1b5ec5ae 100755
(executable)
--- a/
plomlombot.py
+++ b/
plomlombot.py
@@
-110,7
+110,7
@@
def lineparser_loop(io, nickname):
def url_check(msg):
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/)'
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)
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:
return True
try:
@@
-136,7
+136,10
@@
def lineparser_loop(io, nickname):
return
title = bs4.BeautifulSoup(r.text).title
if title:
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")
else:
notice("PAGE HAS NO TITLE TAG")