diff options
author | Awal Garg <awalgarg@gmail.com> | 2023-10-08 01:57:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-08 01:57:23 +0200 |
commit | 9d7ded6419089c1bf252496073f73ad90ed71004 (patch) | |
tree | ab5806dbc11311351e3307cf9356d87f21aab908 /yt_dlp/utils/_utils.py | |
parent | 4392c4680c383b221b6aa26d25c6e4b5581a5ad6 (diff) |
[utils] `js_to_json`: Fix `Date` constructor parsing (#8295)
Authored by: awalgarg, Grub4K
Diffstat (limited to 'yt_dlp/utils/_utils.py')
-rw-r--r-- | yt_dlp/utils/_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py index ba6242380..3dc17bf59 100644 --- a/yt_dlp/utils/_utils.py +++ b/yt_dlp/utils/_utils.py @@ -2744,7 +2744,7 @@ def js_to_json(code, vars={}, *, strict=False): 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) + code = re.sub(rf'new Date\(({STRING_RE})\)', r'\g<1>', code) code = re.sub(r'new \w+\((.*?)\)', lambda m: json.dumps(m.group(0)), code) code = re.sub(r'parseInt\([^\d]+(\d+)[^\d]+\)', r'\1', code) code = re.sub(r'\(function\([^)]*\)\s*\{[^}]*\}\s*\)\s*\(\s*(["\'][^)]*["\'])\s*\)', r'\1', code) |