YCC module: fix too many « Bad URL »
This commit is contained in:
parent
907a655732
commit
2fdd629ccf
@ -23,7 +23,7 @@ class Tinyfier(threading.Thread):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
(status, page) = getPage("ycc.fr", "/redirection/create/" + self.url)
|
(status, page) = getPage("ycc.fr", "/redirection/create/" + self.url)
|
||||||
if status == http.client.OK:
|
if status == http.client.OK and len(page) < 100:
|
||||||
srv = re.match(".*((ht|f)tps?://|www.)([^/ ]+).*", self.url)
|
srv = re.match(".*((ht|f)tps?://|www.)([^/ ]+).*", self.url)
|
||||||
if srv is None:
|
if srv is None:
|
||||||
self.msg.send_chn("Mauvaise URL : %s" % (self.url))
|
self.msg.send_chn("Mauvaise URL : %s" % (self.url))
|
||||||
@ -31,6 +31,7 @@ class Tinyfier(threading.Thread):
|
|||||||
self.msg.send_chn("URL pour %s : %s" % (srv.group(3), page.decode()))
|
self.msg.send_chn("URL pour %s : %s" % (srv.group(3), page.decode()))
|
||||||
else:
|
else:
|
||||||
print ("ERROR: ycc.fr seem down?")
|
print ("ERROR: ycc.fr seem down?")
|
||||||
|
self.msg.send_chn("La situation est embarassante, il semblerait que YCC soit down :(")
|
||||||
|
|
||||||
def parseanswer(msg):
|
def parseanswer(msg):
|
||||||
global LAST_URLS
|
global LAST_URLS
|
||||||
@ -48,7 +49,7 @@ def parseanswer(msg):
|
|||||||
t = Tinyfier(url, msg)
|
t = Tinyfier(url, msg)
|
||||||
t.start()
|
t.start()
|
||||||
else:
|
else:
|
||||||
msg.send_chn("%s: je ne peux pas reduire autant d'URL d'un seul coup." % msg.sender)
|
msg.send_chn("%s: je ne peux pas réduire autant d'URL d'un seul coup." % msg.sender)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user