YCC module: never fail, even if bad URL is given
This commit is contained in:
parent
d56f873fd4
commit
471e40aed1
1 changed files with 12 additions and 9 deletions
|
|
@ -58,8 +58,9 @@ def cmd_ycc(msg):
|
||||||
|
|
||||||
def parselisten(msg):
|
def parselisten(msg):
|
||||||
global LAST_URLS
|
global LAST_URLS
|
||||||
urls = re.findall("([a-zA-Z0-9+.-]+:(//)?[^ ]+)", msg.content)
|
try:
|
||||||
for (url, osef) in urls:
|
urls = re.findall("([a-zA-Z0-9+.-]+:(?://)?[^ ]+)", msg.content)
|
||||||
|
for url in urls:
|
||||||
o = urlparse(url)
|
o = urlparse(url)
|
||||||
if o.scheme != "":
|
if o.scheme != "":
|
||||||
if o.netloc == "ycc.fr" or (o.netloc == "" and len(o.path) < 10):
|
if o.netloc == "ycc.fr" or (o.netloc == "" and len(o.path) < 10):
|
||||||
|
|
@ -67,6 +68,8 @@ def parselisten(msg):
|
||||||
if msg.channel not in LAST_URLS:
|
if msg.channel not in LAST_URLS:
|
||||||
LAST_URLS[msg.channel] = list()
|
LAST_URLS[msg.channel] = list()
|
||||||
LAST_URLS[msg.channel].append(o.geturl())
|
LAST_URLS[msg.channel].append(o.geturl())
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def parseresponse(res):
|
def parseresponse(res):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue