aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-09-09 09:58:41 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-09-10 03:42:14 +0530
commit0cb0fdbbfe32a0e8bc03c3248b95ec473a98b5cc (patch)
treee44c3e8fc7dbab3c6a0feb4d0741219e18ca70bc
parent0831d95c46e0a198957d44262bb251113346a6b4 (diff)
downloadhypervideo-pre-0cb0fdbbfe32a0e8bc03c3248b95ec473a98b5cc.tar.lz
hypervideo-pre-0cb0fdbbfe32a0e8bc03c3248b95ec473a98b5cc.tar.xz
hypervideo-pre-0cb0fdbbfe32a0e8bc03c3248b95ec473a98b5cc.zip
[extractor/common] Escape `%` in `representation_id` of m3u8
Closes #4877
-rw-r--r--yt_dlp/extractor/common.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 02a4c6cec..dae952f6a 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -2914,6 +2914,8 @@ class InfoExtractor:
def prepare_template(template_name, identifiers):
tmpl = representation_ms_info[template_name]
+ if representation_id is not None:
+ tmpl = tmpl.replace('$RepresentationID$', representation_id)
# First of, % characters outside $...$ templates
# must be escaped by doubling for proper processing
# by % operator string formatting used further (see
@@ -2928,8 +2930,6 @@ class InfoExtractor:
t += c
# Next, $...$ templates are translated to their
# %(...) 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)\2', t)
t.replace('$$', '$')