aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-02-10 21:16:58 +0600
committerSergey M․ <dstftw@gmail.com>2016-02-10 21:16:58 +0600
commite2effb08a46817104b56a6242616fd60848251d9 (patch)
treef8d1368dcc2c2c8b5c8d3e4adba4564e8a7653cd
parent7fcea295c59f3321c5a70cb8171e6d5de1f378e4 (diff)
[YoutubeDL] Sanitize format_id (Closes #8494)
-rwxr-xr-xyoutube_dl/YoutubeDL.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 50228bb32..3cabfbc03 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -1288,6 +1288,9 @@ class YoutubeDL(object):
if format.get('format_id') is None:
format['format_id'] = compat_str(i)
+ else:
+ # Sanitize format_id from characters used in format selector expression
+ format['format_id'] = re.sub('[\s,/+\[\]()]', '_', format['format_id'])
format_id = format['format_id']
if format_id not in formats_dict:
formats_dict[format_id] = []