]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Escape possible `$` in `_extract_n_function_name` regex
authorLesmiscore <redacted>
Sun, 20 Feb 2022 08:33:58 +0000 (17:33 +0900)
committerLesmiscore <redacted>
Sun, 20 Feb 2022 08:33:58 +0000 (17:33 +0900)
yt_dlp/extractor/youtube.py

index c03637f5f79ae838e805877271f761b5bfbd7877..4d9815eb32a72d85485c4930bca12568dbcbecec 100644 (file)
@@ -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):