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
This commit is contained in:
Eric Le Lay 2020-03-22 16:03:44 +01:00
parent 9721620cec
commit 120e01fbed
1 changed files with 3 additions and 1 deletions

View File

@ -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