Modules: avoid unhandled exception in all_post

This commit is contained in:
nemunaire 2015-10-13 07:49:53 +02:00
parent 68e357d037
commit 76ec0d26b4
3 changed files with 3 additions and 7 deletions

View File

@ -79,7 +79,7 @@ def parselisten(msg):
@hook("all_post")
def parseresponse(msg):
global LAST_URLS
try:
if hasattr(msg, "text") and msg.text:
urls = re.findall("([a-zA-Z0-9+.-]+:(?://)?[^ :]+)", msg.text)
for url in urls:
o = urlparse(url, "http")
@ -92,8 +92,6 @@ def parseresponse(msg):
if recv not in LAST_URLS:
LAST_URLS[recv] = list()
LAST_URLS[recv].append(url)
except:
pass
return msg

View File

@ -79,14 +79,12 @@ def parselisten(msg):
def parseresponse(msg):
global LAST_SUBS
try:
if hasattr(msg, "text") and msg.text:
urls = re.findall("www.reddit.com(/\w/\w+/?)", msg.text)
for url in urls:
for recv in msg.receivers:
if recv not in LAST_SUBS:
LAST_SUBS[recv] = list()
LAST_SUBS[recv].append(url)
except:
pass
return msg

View File

@ -82,7 +82,7 @@ def parselisten(msg):
@hook("all_post")
def parseresponse(msg):
global LAST_URLS
if hasattr(msg, "text"):
if hasattr(msg, "text") and msg.text:
urls = re.findall("([a-zA-Z0-9+.-]+:(?://)?[^ :]+)", msg.text)
for url in urls:
o = urlparse(url)