14 lines
376 B
Python
14 lines
376 B
Python
from linkify_it import LinkifyIt
|
|
from linkify_it.tlds import TLDS
|
|
|
|
|
|
def extract_urls(text: str, deepweb_tls: bool = False, fuzzy_ip: bool = False):
|
|
linkify = LinkifyIt()
|
|
linkify.tlds(TLDS)
|
|
if deepweb_tls:
|
|
linkify.tlds("i2p", True)
|
|
linkify.tlds("onion", True)
|
|
if fuzzy_ip:
|
|
linkify.set({"fuzzy_ip": True})
|
|
|
|
return linkify.match(text)
|