From f230093e0aecdc7f543579eb6355bff2faa458d5 Mon Sep 17 00:00:00 2001 From: sepro <4618135+seproDev@users.noreply.github.com> Date: Sat, 4 May 2024 15:22:20 +0200 Subject: [PATCH] Don't check broken formats twice --- yt_dlp/YoutubeDL.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index f4aacab90..e0d58f0f4 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2136,8 +2136,10 @@ class YoutubeDL: def _check_formats(self, formats): for f in formats: - if f.get('__working'): - yield f + working = f.get('__working') + if working is not None: + if working: + yield f continue self.to_screen('[info] Testing format %s' % f['format_id']) path = self.get_output_path('temp') @@ -2155,8 +2157,8 @@ class YoutubeDL: os.remove(temp_file.name) except OSError: self.report_warning('Unable to delete temporary file "%s"' % temp_file.name) + f['__working'] = success if success: - f['__working'] = True yield f else: self.to_screen('[info] Unable to download format %s. Skipping...' % f['format_id'])