1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

YoutubeDL: format spec: don't accept a bare '/' (#6124)

This commit is contained in:
Jaime Marquínez Ferrándiz 2015-08-03 23:04:11 +02:00
parent e704f87f86
commit d96d604e53
2 changed files with 3 additions and 0 deletions

View File

@ -311,6 +311,7 @@ class TestFormatSelection(unittest.TestCase):
assert_syntax_error('bestvideo,,best')
assert_syntax_error('+bestaudio')
assert_syntax_error('bestvideo+')
assert_syntax_error('/')
def test_format_filtering(self):
formats = [

View File

@ -960,6 +960,8 @@ class YoutubeDL(object):
selectors.append(current_selector)
current_selector = None
elif string == '/':
if not current_selector:
raise syntax_error('"/" must follow a format selector', start)
first_choice = current_selector
second_choice = _parse_format_selection(tokens, inside_choice=True)
current_selector = FormatSelector(PICKFIRST, (first_choice, second_choice), [])