]> jfr.im git - yt-dlp.git/commitdiff
Ensure directory exists when checking formats
authorpukkandan <redacted>
Fri, 26 Nov 2021 20:32:45 +0000 (02:02 +0530)
committerpukkandan <redacted>
Sat, 27 Nov 2021 13:51:48 +0000 (19:21 +0530)
yt_dlp/YoutubeDL.py

index 3a409b652391be6fbbf76439640a6cad7c36ffed..73834b70f3497c7cc5c118eaa616c62c7fcbd763 100644 (file)
@@ -1740,9 +1740,10 @@ def _filter(f):
     def _check_formats(self, formats):
         for f in formats:
             self.to_screen('[info] Testing format %s' % f['format_id'])
-            temp_file = tempfile.NamedTemporaryFile(
-                suffix='.tmp', delete=False,
-                dir=self.get_output_path('temp') or None)
+            path = self.get_output_path('temp')
+            if not self._ensure_dir_exists(f'{path}/'):
+                continue
+            temp_file = tempfile.NamedTemporaryFile(suffix='.tmp', delete=False, dir=path or None)
             temp_file.close()
             try:
                 success, _ = self.dl(temp_file.name, f, test=True)