A feature-rich command-line audio/video downloader
Fix --restrict-filename when used with default template
pukkandan71ce444a3fec
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex fd8ad0f983..8cfb18e036 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: xouttmpl_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):