|
|
@@ -188,11 +188,10 @@ async def calc_distance_from_ip(ip1: str, ip2: str) -> float:
|
|
|
|
|
|
|
|
|
def get_urls_from_text(text: str) -> bool:
|
|
|
- # TODO This also matches ip address, fix soon
|
|
|
- regex = r"""(?i)\b((?:https?:\/\/|(www|\w+)\d{0,3}[.]|[a-z
|
|
|
- 0-9.\-][.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+
|
|
|
- |(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\()<>
|
|
|
- ]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""".strip()
|
|
|
+ regex = r"""(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]
|
|
|
+ [.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(
|
|
|
+ \([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\
|
|
|
+ ()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))""".strip()
|
|
|
return [x[0] for x in findall(regex, text)]
|
|
|
|
|
|
|