aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-10-17 01:03:04 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-10-17 01:03:04 +0530
commit71ce444a3fece1f7de779b358943de4ac14aa0f4 (patch)
tree82c42be213e47192baa989c0ca993d930f3cfb19
parent580d3274e50d9cca79189689ba53db7295ea267c (diff)
downloadhypervideo-pre-71ce444a3fece1f7de779b358943de4ac14aa0f4.tar.lz
hypervideo-pre-71ce444a3fece1f7de779b358943de4ac14aa0f4.tar.xz
hypervideo-pre-71ce444a3fece1f7de779b358943de4ac14aa0f4.zip
Fix --restrict-filename when used with default template
-rw-r--r--yt_dlp/YoutubeDL.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index fd8ad0f98..8cfb18e03 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -889,8 +889,13 @@ class YoutubeDL(object):
outtmpl_dict = self.params.get('outtmpl', {})
if not isinstance(outtmpl_dict, dict):
outtmpl_dict = {'default': outtmpl_dict}
+ # Remove spaces in the default template
+ if self.params.get('restrictfilenames'):
+ sanitize = lambda x: x.replace(' - ', ' ').replace(' ', '-')
+ else:
+ sanitize = lambda x: x
outtmpl_dict.update({
- k: v for k, v in DEFAULT_OUTTMPL.items()
+ k: sanitize(v) for k, v in DEFAULT_OUTTMPL.items()
if outtmpl_dict.get(k) is None})
for key, val in outtmpl_dict.items():
if isinstance(val, bytes):