mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-03 08:19:57 +01:00
This commit is contained in:
parent
be80986ed9
commit
b08e235f09
@ -2617,14 +2617,22 @@ def compat_parse_qs(qs, keep_blank_values=False, strict_parsing=False,
|
|||||||
parsed_result[name] = [value]
|
parsed_result[name] = [value]
|
||||||
return parsed_result
|
return parsed_result
|
||||||
|
|
||||||
try:
|
|
||||||
from shlex import quote as compat_shlex_quote
|
compat_os_name = os._name if os.name == 'java' else os.name
|
||||||
except ImportError: # Python < 3.3
|
|
||||||
|
|
||||||
|
if compat_os_name == 'nt':
|
||||||
def compat_shlex_quote(s):
|
def compat_shlex_quote(s):
|
||||||
if re.match(r'^[-_\w./]+$', s):
|
return s if re.match(r'^[-_\w./]+$', s) else '"%s"' % s.replace('"', '\\"')
|
||||||
return s
|
else:
|
||||||
else:
|
try:
|
||||||
return "'" + s.replace("'", "'\"'\"'") + "'"
|
from shlex import quote as compat_shlex_quote
|
||||||
|
except ImportError: # Python < 3.3
|
||||||
|
def compat_shlex_quote(s):
|
||||||
|
if re.match(r'^[-_\w./]+$', s):
|
||||||
|
return s
|
||||||
|
else:
|
||||||
|
return "'" + s.replace("'", "'\"'\"'") + "'"
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -2649,9 +2657,6 @@ def compat_ord(c):
|
|||||||
return ord(c)
|
return ord(c)
|
||||||
|
|
||||||
|
|
||||||
compat_os_name = os._name if os.name == 'java' else os.name
|
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
compat_getenv = os.getenv
|
compat_getenv = os.getenv
|
||||||
compat_expanduser = os.path.expanduser
|
compat_expanduser = os.path.expanduser
|
||||||
|
Loading…
Reference in New Issue
Block a user