mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-27 21:59:17 +01:00
parent
32972518da
commit
f55523cfdd
1 changed files with 2 additions and 1 deletions
|
@ -3298,7 +3298,7 @@ def js_to_json(code, vars={}, *, strict=False):
|
||||||
return '"%d":' % i if v.endswith(':') else '%d' % i
|
return '"%d":' % i if v.endswith(':') else '%d' % i
|
||||||
|
|
||||||
if v in vars:
|
if v in vars:
|
||||||
return vars[v]
|
return json.dumps(vars[v])
|
||||||
if strict:
|
if strict:
|
||||||
raise ValueError(f'Unknown value: {v}')
|
raise ValueError(f'Unknown value: {v}')
|
||||||
|
|
||||||
|
@ -3310,6 +3310,7 @@ def js_to_json(code, vars={}, *, strict=False):
|
||||||
code = re.sub(r'new Map\((\[.*?\])?\)', create_map, code)
|
code = re.sub(r'new Map\((\[.*?\])?\)', create_map, code)
|
||||||
if not strict:
|
if not strict:
|
||||||
code = re.sub(r'new Date\((".+")\)', r'\g<1>', code)
|
code = re.sub(r'new Date\((".+")\)', r'\g<1>', code)
|
||||||
|
code = re.sub(r'new \w+\((.*?)\)', lambda m: json.dumps(m.group(0)), code)
|
||||||
|
|
||||||
return re.sub(r'''(?sx)
|
return re.sub(r'''(?sx)
|
||||||
"(?:[^"\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^"\\]*"|
|
"(?:[^"\\]*(?:\\\\|\\['"nurtbfx/\n]))*[^"\\]*"|
|
||||||
|
|
Loading…
Reference in a new issue