aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-03-26 07:39:36 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-03-26 07:39:59 +0530
commit34baa9fdf050895c4a09107964d396079da5bb45 (patch)
tree48be48d04f1931e57db1a23ef75899512fe09f0d /yt_dlp
parent6db9c4d57d033fb22c94a2e6f1ecf0207e700b4c (diff)
downloadhypervideo-pre-34baa9fdf050895c4a09107964d396079da5bb45.tar.lz
hypervideo-pre-34baa9fdf050895c4a09107964d396079da5bb45.tar.xz
hypervideo-pre-34baa9fdf050895c4a09107964d396079da5bb45.zip
[outtmpl] Fix replacement/default when used with alternate
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/YoutubeDL.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 5771fbcf7..478bdacca 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1099,10 +1099,11 @@ class YoutubeDL(object):
(?P<fields>{field})
(?P<maths>(?:{math_op}{math_field})*)
(?:>(?P<strf_format>.+?))?
- (?P<alternate>(?<!\\),[^|&)]+)?
- (?:&(?P<replacement>.*?))?
- (?:\|(?P<default>.*?))?
- $'''.format(field=FIELD_RE, math_op=MATH_OPERATORS_RE, math_field=MATH_FIELD_RE))
+ (?P<remaining>
+ (?P<alternate>(?<!\\),[^|&)]+)?
+ (?:&(?P<replacement>.*?))?
+ (?:\|(?P<default>.*?))?
+ )$'''.format(field=FIELD_RE, math_op=MATH_OPERATORS_RE, math_field=MATH_FIELD_RE))
def _traverse_infodict(k):
k = k.split('.')
@@ -1173,7 +1174,7 @@ class YoutubeDL(object):
value = get_value(mobj)
replacement = mobj['replacement']
if value is None and mobj['alternate']:
- mobj = re.match(INTERNAL_FORMAT_RE, mobj['alternate'][1:])
+ mobj = re.match(INTERNAL_FORMAT_RE, mobj['remaining'][1:])
else:
break