This commit is contained in:
M.K 2024-06-27 06:34:31 +08:00 committed by GitHub
commit f57da151d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -136,6 +136,11 @@ class TestFormatSelection(unittest.TestCase):
] ]
info_dict = _make_result(formats) 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'], '35')
ydl = YDL({'format': '20/47'}) ydl = YDL({'format': '20/47'})
ydl.process_ie_result(info_dict.copy()) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]

View File

@ -1293,6 +1293,9 @@ class YoutubeDL(object):
'{0}\n\t{1}\n\t{2}^'.format(note, format_spec, ' ' * start[1])) '{0}\n\t{1}\n\t{2}^'.format(note, format_spec, ' ' * start[1]))
return SyntaxError(message) return SyntaxError(message)
if not format_spec:
format_spec = 'worst'
PICKFIRST = 'PICKFIRST' PICKFIRST = 'PICKFIRST'
MERGE = 'MERGE' MERGE = 'MERGE'
SINGLE = 'SINGLE' SINGLE = 'SINGLE'