]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[YoutubeDL] Sanitize format_id (Closes #8494)
authorSergey M․ <dstftw@gmail.com>
Wed, 10 Feb 2016 15:16:58 +0000 (21:16 +0600)
committerSergey M․ <dstftw@gmail.com>
Wed, 10 Feb 2016 15:16:58 +0000 (21:16 +0600)
youtube_dl/YoutubeDL.py

index 50228bb321d3b4076bdff438624b5136da2f6e87..3cabfbc03257691f5c27a0cc05cd8376086ba7b9 100755 (executable)
@@ -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] = []