From 9ebac35577e61c3d25fafc959655fa3ab04ca7ef Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 16 Feb 2023 17:06:48 +0530 Subject: [PATCH] Bugfix for 39f32f1715c0dffb7626dda7307db6388bb7abaa when `--ignore-no-formats-error` --- yt_dlp/YoutubeDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index d214a6449..33b4fb3ca 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -2557,7 +2557,7 @@ class YoutubeDL: formats = self._get_formats(info_dict) # Backward compatibility with InfoExtractor._sort_formats - field_preference = formats[0].pop('__sort_fields', None) + field_preference = (formats or [{}])[0].pop('__sort_fields', None) if field_preference: info_dict['_format_sort_fields'] = field_preference