tools/web: factorize getNormalizedURL

This commit is contained in:
nemunaire 2015-10-14 00:17:02 +02:00
commit 55e6550cb1
7 changed files with 26 additions and 21 deletions

View file

@ -3,7 +3,7 @@ import re, json, subprocess
from nemubot.exception import IRCException
from nemubot.hooks import hook
from nemubot.tools.web import getURLContent
from nemubot.tools.web import _getNormalizedURL, getURLContent
from more import Response
"""Get information of youtube videos"""
@ -85,7 +85,7 @@ def parseresponse(msg):
if hasattr(msg, "text") and msg.text:
urls = re.findall("([a-zA-Z0-9+.-]+:(?://)?[^ :]+)", msg.text)
for url in urls:
o = urlparse(url)
o = urlparse(_getNormalizedURL(url))
if o.scheme != "":
if o.netloc == "" and len(o.path) < 10:
continue