From 120e01fbed231ffd9e148844143e6b584459b3b8 Mon Sep 17 00:00:00 2001 From: Eric Le Lay Date: Sun, 22 Mar 2020 16:03:44 +0100 Subject: [PATCH] youtube-dl: fix 'Error in output template: unsupported format character' when title contains dollar or percent We pass the filename to YoutubeDL as the outtmpl parameter, which is used as a string template. See YoutubeDL.py, line 711: filename = expand_path(outtmpl).replace(sep, '') % template_dict --- share/gpodder/extensions/youtube-dl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/gpodder/extensions/youtube-dl.py b/share/gpodder/extensions/youtube-dl.py index 36a39eb9..faf3aa7f 100644 --- a/share/gpodder/extensions/youtube-dl.py +++ b/share/gpodder/extensions/youtube-dl.py @@ -290,7 +290,9 @@ class gPodderYoutubeDL(download.CustomDownloader): def fetch_video(self, url, tempname, reporthook): opts = { - 'outtmpl': tempname, # use given tempname by DownloadTask + # outtmpl: use given tempname by DownloadTask + # (escape % and $ because outtmpl used as a string template by youtube-dl) + 'outtmpl': tempname.replace('%', '%%').replace('$', '$$'), 'nopart': True, # don't append .part (already .partial) 'retries': 3, # retry a few times 'progress_hooks': [reporthook] # to notify UI