1
0
mirror of http://aero2k.de/t/repos/urlbot-native.git synced 2017-09-06 15:25:38 +02:00

add URL blacklist; add command_show_blacklist()

This commit is contained in:
urlbot
2014-11-28 19:13:45 +01:00
parent 368469ec7d
commit 31f1e285c6
3 changed files with 37 additions and 1 deletions

View File

@@ -140,6 +140,18 @@ def extract_url(data):
if ratelimit_exceeded():
return False
flag = False
for b in conf('url_blacklist'):
if not None is re.match(b, url):
flag = True
message = 'url blacklist match for ' + url
logger('info', message)
chat_write(message)
if flag:
# an URL has matched the blacklist, continue to the next URL
continue
# urllib.request is broken:
# >>> '.'.encode('idna')
# ....