mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-17 04:36:57 +00:00
issue #25: all test checked and passed. the funcs in the utils file are specifically for this folder don't use elsewhere
This commit is contained in:
parent
fb09b21684
commit
574a11fdc5
3 changed files with 37 additions and 50 deletions
|
@ -5,7 +5,7 @@ def IsOnionValid(url: str)-> bool:
|
|||
Checks if the domain(param) is a valid onion domain and return True else False.
|
||||
"""
|
||||
try:
|
||||
pattern = re.compile("^[A-Za-z0-9.]+(.onion)?$")
|
||||
pattern = re.compile(r"^[A-Za-z0-9:/._%-=#?&@]+(.onion)$")
|
||||
url = url.strip().removesuffix('/')
|
||||
if url.startswith('http://'):
|
||||
domain = url.split('/')[2]
|
||||
|
@ -40,7 +40,7 @@ def IsUrlValid(url:str)->bool:
|
|||
"""
|
||||
Check if url is valid both dark net end clearnet.
|
||||
"""
|
||||
pattern = re.compile("^[A-Za-z0-9:/.-]+$")
|
||||
pattern = re.compile(r"^[A-Za-z0-9:/._%-=#?&@]+$")
|
||||
url = str(url)
|
||||
if len(url) < 4:
|
||||
return False
|
||||
|
@ -51,4 +51,4 @@ def IsUrlValid(url:str)->bool:
|
|||
return False
|
||||
if pattern.fullmatch(url) is None:
|
||||
return False
|
||||
return True
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue