mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 11:01:34 -05:00
YoutubeDL: format spec: don't accept a bare '/' (#6124)
This commit is contained in:
parent
e704f87f86
commit
d96d604e53
2 changed files with 3 additions and 0 deletions
|
@ -311,6 +311,7 @@ def assert_syntax_error(format_spec):
|
||||||
assert_syntax_error('bestvideo,,best')
|
assert_syntax_error('bestvideo,,best')
|
||||||
assert_syntax_error('+bestaudio')
|
assert_syntax_error('+bestaudio')
|
||||||
assert_syntax_error('bestvideo+')
|
assert_syntax_error('bestvideo+')
|
||||||
|
assert_syntax_error('/')
|
||||||
|
|
||||||
def test_format_filtering(self):
|
def test_format_filtering(self):
|
||||||
formats = [
|
formats = [
|
||||||
|
|
|
@ -960,6 +960,8 @@ def _parse_format_selection(tokens, inside_merge=False, inside_choice=False, ins
|
||||||
selectors.append(current_selector)
|
selectors.append(current_selector)
|
||||||
current_selector = None
|
current_selector = None
|
||||||
elif string == '/':
|
elif string == '/':
|
||||||
|
if not current_selector:
|
||||||
|
raise syntax_error('"/" must follow a format selector', start)
|
||||||
first_choice = current_selector
|
first_choice = current_selector
|
||||||
second_choice = _parse_format_selection(tokens, inside_choice=True)
|
second_choice = _parse_format_selection(tokens, inside_choice=True)
|
||||||
current_selector = FormatSelector(PICKFIRST, (first_choice, second_choice), [])
|
current_selector = FormatSelector(PICKFIRST, (first_choice, second_choice), [])
|
||||||
|
|
Loading…
Reference in a new issue