diff --git a/plugins/urltools.py b/plugins/urltools.py index 37ceae2..e5121d5 100755 --- a/plugins/urltools.py +++ b/plugins/urltools.py @@ -8,24 +8,6 @@ ignored_urls = ["http://google.com", "http://youtube.com", "http://pastebin.com", "http://mibpaste.com", "http://fpaste.com", "http://git.io"] -wordDic = { -'"': '"', -''': '\'', -'&': '&', -'<': '<', -'>': '>', -'«': '«', -'"': '"', -''': '\'', -'&': '&', -'<': '<', -'>': '>', -'«': '«', -'!': '!', -'$': '$', -' ': ' '} - - def parse(match): url = urlnorm.normalize(match.encode('utf-8')) if url not in ignored_urls: @@ -36,15 +18,6 @@ def parse(match): except: return "fail" - -def multiwordReplace(text, wordDic): - rc = re.compile('|'.join(map(re.escape, wordDic))) - - def translate(match): - return wordDic[match.group(0)] - return rc.sub(translate, text) - - @hook.regex(r'([a-zA-Z]://|www\.)?[^ ]+(\.[a-z]+)+') def urlparser(match, say=None): url = urlnorm.normalize(match.group().encode('utf-8')) @@ -57,7 +30,7 @@ def urlparser(match, say=None): title = parse(url) if title == "fail": return - title = multiwordReplace(title, wordDic) + title = http.unescape(title) realurl = http.get_url(url) if realurl == url: say("(Link) %s" % title)