From 1dcf6615b4abf1fd78945a39927e562992998477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 22 Aug 2025 22:50:51 +0200 Subject: [PATCH] [dl:ytdl] improve playlist filename handling --- gallery_dl/downloader/ytdl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index c236f91a..43ed8ffe 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -168,9 +168,12 @@ class YoutubeDLDownloader(DownloaderBase): return True def _download_playlist(self, ytdl_instance, pathfmt, info_dict): - pathfmt.set_extension("%(playlist_index)s.%(ext)s") - pathfmt.build_path() - self._set_outtmpl(ytdl_instance, pathfmt.realpath) + pathfmt.kwdict["extension"] = pathfmt.prefix + filename = pathfmt.build_filename(pathfmt.kwdict) + pathfmt.kwdict["extension"] = pathfmt.extension + path = pathfmt.realdirectory + filename + path = path.replace("%", "%%") + "%(playlist_index)s.%(ext)s" + self._set_outtmpl(ytdl_instance, path) status = False for entry in info_dict["entries"]: