Another fix for join sounds not playing, should be working in all cases now.

This commit is contained in:
Storm Dragon
2026-07-14 20:54:51 -04:00
parent 14163bdbc1
commit 213aa3770a
3 changed files with 109 additions and 9 deletions
+39 -6
View File
@@ -21,6 +21,7 @@ from sys import platform
import traceback
import requests
from packaging import version
from urllib.parse import urlsplit, urlunsplit
import yt_dlp as youtube_dl
YT_PKG_NAME = 'yt-dlp'
@@ -365,6 +366,28 @@ class Dir(object):
# Parse the html from the message to get the URL
def _lower_url_host(netloc):
userinfo = ""
hostport = netloc
if "@" in netloc:
userinfo, hostport = netloc.rsplit("@", 1)
userinfo += "@"
if hostport.startswith("["):
closing_bracket = hostport.find("]")
if closing_bracket != -1:
host = hostport[:closing_bracket + 1]
suffix = hostport[closing_bracket + 1:]
return userinfo + host.lower() + suffix
if ":" in hostport:
host, separator, port = hostport.rpartition(":")
if port.isdigit():
return userinfo + host.lower() + separator + port
return userinfo + hostport.lower()
def get_url_from_input(string):
string = string.strip()
if not (string.startswith("http") or string.startswith("HTTP")):
@@ -374,14 +397,24 @@ def get_url_from_input(string):
else:
return ""
match = re.search(r"(http|https)://(\S*)?/(\S*)", string, flags=re.IGNORECASE)
if match:
url = match[1].lower() + "://" + match[2].lower() + "/" + match[3]
# https://github.com/mumble-voip/mumble/issues/4999
return html.unescape(url)
else:
match = re.match(r"https?://\S+", string, flags=re.IGNORECASE)
if not match:
return ""
# https://github.com/mumble-voip/mumble/issues/4999
url = html.unescape(match.group(0))
parsed = urlsplit(url)
if parsed.scheme.lower() not in ("http", "https") or not parsed.netloc:
return ""
return urlunsplit((
parsed.scheme.lower(),
_lower_url_host(parsed.netloc),
parsed.path,
parsed.query,
parsed.fragment,
))
def youtube_search(query):
global log