mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 09:01:43 +00:00
parent
0831d95c46
commit
0cb0fdbbfe
@ -2914,6 +2914,8 @@ def extract_Initialization(source):
|
|||||||
|
|
||||||
def prepare_template(template_name, identifiers):
|
def prepare_template(template_name, identifiers):
|
||||||
tmpl = representation_ms_info[template_name]
|
tmpl = representation_ms_info[template_name]
|
||||||
|
if representation_id is not None:
|
||||||
|
tmpl = tmpl.replace('$RepresentationID$', representation_id)
|
||||||
# First of, % characters outside $...$ templates
|
# First of, % characters outside $...$ templates
|
||||||
# must be escaped by doubling for proper processing
|
# must be escaped by doubling for proper processing
|
||||||
# by % operator string formatting used further (see
|
# by % operator string formatting used further (see
|
||||||
@ -2928,8 +2930,6 @@ def prepare_template(template_name, identifiers):
|
|||||||
t += c
|
t += c
|
||||||
# Next, $...$ templates are translated to their
|
# Next, $...$ templates are translated to their
|
||||||
# %(...) counterparts to be used with % operator
|
# %(...) counterparts to be used with % operator
|
||||||
if representation_id is not None:
|
|
||||||
t = t.replace('$RepresentationID$', representation_id)
|
|
||||||
t = re.sub(r'\$(%s)\$' % '|'.join(identifiers), r'%(\1)d', t)
|
t = re.sub(r'\$(%s)\$' % '|'.join(identifiers), r'%(\1)d', t)
|
||||||
t = re.sub(r'\$(%s)%%([^$]+)\$' % '|'.join(identifiers), r'%(\1)\2', t)
|
t = re.sub(r'\$(%s)%%([^$]+)\$' % '|'.join(identifiers), r'%(\1)\2', t)
|
||||||
t.replace('$$', '$')
|
t.replace('$$', '$')
|
||||||
|
Loading…
Reference in New Issue
Block a user