From 3ec7ee6baa8103163e437d077f3ebb734e598cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 2 Jun 2024 17:44:00 +0200 Subject: [PATCH] [downloader:ytdl] fix exception due to missing 'ext' (#5675) --- gallery_dl/downloader/ytdl.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index adada752..87e77562 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -89,6 +89,11 @@ class YoutubeDLDownloader(DownloaderBase): formats = info_dict.get("requested_formats") if formats and not compatible_formats(formats): info_dict["ext"] = "mkv" + elif "ext" not in info_dict: + try: + info_dict["ext"] = info_dict["formats"][0]["ext"] + except LookupError: + info_dict["ext"] = "mp4" if self.outtmpl: self._set_outtmpl(ytdl_instance, self.outtmpl)