From ce031e9d18cd8ec154a749ba5c066c8c0f7eec6b Mon Sep 17 00:00:00 2001 From: mk-pmb Date: Thu, 16 May 2024 02:26:47 +0200 Subject: [PATCH] [core] Empty format selection string means anything goes. --- test/test_YoutubeDL.py | 5 +++++ youtube_dl/YoutubeDL.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index d994682b2..7040cd93a 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -136,6 +136,11 @@ class TestFormatSelection(unittest.TestCase): ] 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.process_ie_result(info_dict.copy()) downloaded = ydl.downloaded_info_dicts[0] diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 6f2aba5ac..062e1fe37 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1289,6 +1289,9 @@ class YoutubeDL(object): '{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'