]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/utils/_utils.py
[utils] `js_to_json`: Handle `Array` objects
[yt-dlp.git] / yt_dlp / utils / _utils.py
index ef26de1160f802908cfb8ba4c6a5352f352c0f59..213ccc63639157617af093b3928f40294a75ae9e 100644 (file)
@@ -2727,6 +2727,7 @@ def fix_kv(m):
     def create_map(mobj):
         return json.dumps(dict(json.loads(js_to_json(mobj.group(1) or '[]', vars=vars))))
 
+    code = re.sub(r'(?:new\s+)?Array\((.*?)\)', r'[\g<1>]', code)
     code = re.sub(r'new Map\((\[.*?\])?\)', create_map, code)
     if not strict:
         code = re.sub(r'new Date\((".+")\)', r'\g<1>', code)