1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-05-19 19:49:33 +00:00
This commit is contained in:
dirkf 2023-12-24 23:30:38 +01:00 committed by GitHub
commit 967e76814c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1737,7 +1737,9 @@ class YoutubeDL(object):
format['format_id'] = compat_str(i)
else:
# Sanitize format_id from characters used in format selector expression
format['format_id'] = re.sub(r'[\s,/+\[\]()]', '_', format['format_id'])
# In fact, replace anything that's not allowed as a value in format selection,
# or (eg) excluding a format_id can crash. See method _build_format_filter()
format['format_id'] = re.sub(r'[^a-zA-Z0-9._-]', '_', format['format_id'])
format_id = format['format_id']
if format_id not in formats_dict:
formats_dict[format_id] = []