mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-09-03 16:45:17 +00:00
[utils] js_to_json
: Make function less fatal (#12715)
Authored by: seproDev
This commit is contained in:
@ -2767,7 +2767,8 @@ def js_to_json(code, vars={}, *, strict=False):
|
||||
def template_substitute(match):
|
||||
evaluated = js_to_json(match.group(1), vars, strict=strict)
|
||||
if evaluated[0] == '"':
|
||||
return json.loads(evaluated)
|
||||
with contextlib.suppress(json.JSONDecodeError):
|
||||
return json.loads(evaluated)
|
||||
return evaluated
|
||||
|
||||
def fix_kv(m):
|
||||
|
Reference in New Issue
Block a user