aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-07-29 05:19:26 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-07-29 08:38:18 +0530
commit901130bbcf799573255ade3e2882dec4670feda8 (patch)
tree92ee87557874b07266d25c14a2e49d53844041f8 /yt_dlp/utils.py
parentc0bc527bca735ee8a8b32857466d75f7d47aa22a (diff)
downloadhypervideo-pre-901130bbcf799573255ade3e2882dec4670feda8.tar.lz
hypervideo-pre-901130bbcf799573255ade3e2882dec4670feda8.tar.xz
hypervideo-pre-901130bbcf799573255ade3e2882dec4670feda8.zip
Expand and escape environment variables correctly in outtmpl
Fixes: https://www.reddit.com/r/youtubedl/comments/otfmq3/ytdlp_same_parameters_different_results
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 4ff53573f..2bd0925b6 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -4438,8 +4438,8 @@ OUTTMPL_TYPES = {
# As of [1] format syntax is:
# %[mapping_key][conversion_flags][minimum_width][.precision][length_modifier]type
# 1. https://docs.python.org/2/library/stdtypes.html#string-formatting
-STR_FORMAT_RE = r'''(?x)
- (?<!%)
+STR_FORMAT_RE_TMPL = r'''(?x)
+ (?<!%)(?P<prefix>(?:%%)*)
%
(?P<has_key>\((?P<key>{0})\))? # mapping key
(?P<format>
@@ -4447,10 +4447,11 @@ STR_FORMAT_RE = r'''(?x)
(?:\d+)? # minimum field width (optional)
(?:\.\d+)? # precision (optional)
[hlL]? # length modifier (optional)
- [diouxXeEfFgGcrs] # conversion type
+ {1} # conversion type
)
'''
+STR_FORMAT_TYPES = 'diouxXeEfFgGcrs'
def limit_length(s, length):
""" Add ellipses to overly long strings """