Skip to content

Commit

Permalink
[core] Empty format selection string means anything goes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-pmb committed May 16, 2024
1 parent e0727e4 commit ea2bcbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def test_format_selection(self):
]
info_dict = _make_result(formats)

ydl = YDL({'format': ''}) # no criteria => anything goes
ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], '2')

ydl = YDL({'format': '20/47'})
ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0]
Expand Down
3 changes: 3 additions & 0 deletions youtube_dl/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,9 @@ def syntax_error(note, start):
'{0}\n\t{1}\n\t{2}^'.format(note, format_spec, ' ' * start[1]))
return SyntaxError(message)

if not format_spec:
format_spec = 'worst'

PICKFIRST = 'PICKFIRST'
MERGE = 'MERGE'
SINGLE = 'SINGLE'
Expand Down

0 comments on commit ea2bcbb

Please sign in to comment.