From 9dfdeb05a7df0d8428c1ffdc9809d1ce855dafbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 3 Aug 2025 13:50:40 +0200 Subject: [PATCH] [dl:ytdl] don't overwrite existing filenames (#7964) --- gallery_dl/downloader/ytdl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gallery_dl/downloader/ytdl.py b/gallery_dl/downloader/ytdl.py index 69a59ffc..9659782c 100644 --- a/gallery_dl/downloader/ytdl.py +++ b/gallery_dl/downloader/ytdl.py @@ -109,7 +109,11 @@ class YoutubeDLDownloader(DownloaderBase): def _download_video(self, ytdl_instance, pathfmt, info_dict): if "url" in info_dict: - text.nameext_from_url(info_dict["url"], pathfmt.kwdict) + if "filename" in pathfmt.kwdict: + pathfmt.kwdict["extension"] = \ + text.ext_from_url(info_dict["url"]) + else: + text.nameext_from_url(info_dict["url"], pathfmt.kwdict) formats = info_dict.get("requested_formats") if formats and not compatible_formats(formats):