tools/web: factorize getNormalizedURL
This commit is contained in:
parent
76ec0d26b4
commit
55e6550cb1
7 changed files with 26 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue