From a7d4acc018378b30188685776e954168e041fa4f Mon Sep 17 00:00:00 2001 From: Lesmiscore Date: Sun, 20 Feb 2022 17:33:58 +0900 Subject: [PATCH] [youtube] Escape possible `$` in `_extract_n_function_name` regex --- yt_dlp/extractor/youtube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index c03637f5f..4d9815eb3 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2418,7 +2418,7 @@ def _extract_n_function_name(self, jscode): if not idx: return nfunc return json.loads(js_to_json(self._search_regex( - rf'var {nfunc}\s*=\s*(\[.+?\]);', jscode, + rf'var {re.escape(nfunc)}\s*=\s*(\[.+?\]);', jscode, f'Initial JS player n function list ({nfunc}.{idx})')))[int(idx)] def _extract_n_function(self, video_id, player_url):