aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-07-10 22:46:25 +0200
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-07-10 22:46:25 +0200
commit0a31a350981931ab9403d58258f5058ed98142a5 (patch)
tree6dee79aa2a6c541961a69e98b6d967d0aeb6bec7 /youtube_dl/YoutubeDL.py
parentbb8e55366289e0c129ef85abb8c1ac1cbae86a66 (diff)
[YoutubeDL] format spec: add additional checks for invalid syntax
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 6478d05dc..da7c51008 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -953,6 +953,8 @@ class YoutubeDL(object):
tokens.restore_last_token()
break
elif string == ',':
+ if not current_selector:
+ raise syntax_error('"," must follow a format selector', start)
selectors.append(current_selector)
current_selector = None
elif string == '/':
@@ -972,6 +974,8 @@ class YoutubeDL(object):
elif string == '+':
video_selector = current_selector
audio_selector = _parse_format_selection(tokens, inside_merge=True)
+ if not video_selector or not audio_selector:
+ raise syntax_error('"+" must be between two format selectors', start)
current_selector = FormatSelector(MERGE, (video_selector, audio_selector), [])
else:
raise syntax_error('Operator not recognized: "{0}"'.format(string), start)