From ca320fef62b33b41570f046fe739b1562d648068 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 15 Oct 2025 10:43:07 +0200 Subject: [PATCH] Catch "requested_format" key error in yt_dlp info dicts. --- src/ytplom/misc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index b59ea7f..92cd728 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -940,7 +940,10 @@ class DownloadsManager: try: info = ydl.sanitize_info(ydl.extract_info(url, download=False)) - for f in info['requested_formats']: + key_formats = 'requested_formats' + if key_formats not in info: + raise YoutubeDLError(f'no "{key_formats}" in info') + for f in info[key_formats]: sizes[f[TOK_FO_ID]] = [False, 1] if TOK_FS_AP in f: sizes[f[TOK_FO_ID]] = [True, f[TOK_FS_AP]] -- 2.30.2