]> git.0d.be Git - botaradio.git/commitdiff
feat: advanced url processing, whitespaces issue
authorTerry Geng <gengyanda@gmail.com>
Thu, 12 Mar 2020 13:04:37 +0000 (21:04 +0800)
committerTerry Geng <gengyanda@gmail.com>
Thu, 12 Mar 2020 13:04:37 +0000 (21:04 +0800)
util.py

diff --git a/util.py b/util.py
index 2192d904ae7456dbcb777e1dda4921e6dfad027c..5698b4eac853926e3e24e8906708cddb305bd72f 100644 (file)
--- a/util.py
+++ b/util.py
@@ -302,7 +302,7 @@ def get_url_from_input(string):
         else:
             return False
 
-    match = re.search("(http|https)://(.*)?/(.*)", string, flags=re.IGNORECASE)
+    match = re.search("(http|https)://(\S*)?/(\S*)", string, flags=re.IGNORECASE)
     if match:
         url = match[1].lower() + "://" + match[2].lower() + "/" + match[3]
         return url