aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/YoutubeDL.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-03-27 10:04:04 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-03-27 11:18:35 +0530
commit5c3895fff150871fde273a10c55691403931b4dc (patch)
tree692946c934742281549d2c10042ef310d321ff50 /yt_dlp/YoutubeDL.py
parentfd2ad7cb245423e49db1be9d9654c7dd3103619a (diff)
downloadhypervideo-pre-5c3895fff150871fde273a10c55691403931b4dc.tar.lz
hypervideo-pre-5c3895fff150871fde273a10c55691403931b4dc.tar.xz
hypervideo-pre-5c3895fff150871fde273a10c55691403931b4dc.zip
[outtmpl] Limit changes during sanitization
Closes #2761
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r--yt_dlp/YoutubeDL.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 478bdacca..c2f4f3a95 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -87,6 +87,7 @@ from .utils import (
MaxDownloadsReached,
merge_headers,
network_exceptions,
+ NO_DEFAULT,
number_of_digits,
orderedSet,
OUTTMPL_TYPES,
@@ -1150,8 +1151,10 @@ class YoutubeDL(object):
na = self.params.get('outtmpl_na_placeholder', 'NA')
def filename_sanitizer(key, value, restricted=self.params.get('restrictfilenames')):
- return sanitize_filename(str(value), restricted=restricted,
- is_id=re.search(r'(^|[_.])id(\.|$)', key))
+ return sanitize_filename(str(value), restricted=restricted, is_id=(
+ bool(re.search(r'(^|[_.])id(\.|$)', key))
+ if 'filename-sanitization' in self.params.get('compat_opts', [])
+ else NO_DEFAULT))
sanitizer = sanitize if callable(sanitize) else filename_sanitizer
sanitize = bool(sanitize)