TheHamkerCat 5 anni fa
parent
commit
77aad833bc
1 ha cambiato i file con 5 aggiunte e 4 eliminazioni
  1. 5 4
      wbb/utils/functions.py

+ 5 - 4
wbb/utils/functions.py

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