mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-14 20:25:19 +00:00
[ie] _resolve_nuxt_array: simplify
Authored by: bashonly
This commit is contained in:
@@ -1801,23 +1801,23 @@ class InfoExtractor:
|
|||||||
if default is not NO_DEFAULT:
|
if default is not NO_DEFAULT:
|
||||||
fatal = False
|
fatal = False
|
||||||
|
|
||||||
# Ref: https://github.com/nuxt/nuxt/commit/9e503be0f2a24f4df72a3ccab2db4d3e63511f57
|
def indirect_reviver(data):
|
||||||
# https://github.com/nuxt/nuxt/pull/19205
|
|
||||||
def simple_reviver(data):
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def empty_reviver(data):
|
def json_reviver(data):
|
||||||
return self._parse_json(data, video_id, fatal=fatal, errnote=None if fatal else False)
|
return json.loads(data)
|
||||||
|
|
||||||
|
# Ref: https://github.com/nuxt/nuxt/commit/9e503be0f2a24f4df72a3ccab2db4d3e63511f57
|
||||||
|
# https://github.com/nuxt/nuxt/pull/19205
|
||||||
try:
|
try:
|
||||||
return devalue.parse(array, revivers={
|
return devalue.parse(array, revivers={
|
||||||
'NuxtError': simple_reviver,
|
'NuxtError': indirect_reviver,
|
||||||
'EmptyShallowRef': empty_reviver,
|
'EmptyShallowRef': json_reviver,
|
||||||
'EmptyRef': empty_reviver,
|
'EmptyRef': json_reviver,
|
||||||
'ShallowRef': simple_reviver,
|
'ShallowRef': indirect_reviver,
|
||||||
'ShallowReactive': simple_reviver,
|
'ShallowReactive': indirect_reviver,
|
||||||
'Ref': simple_reviver,
|
'Ref': indirect_reviver,
|
||||||
'Reactive': simple_reviver,
|
'Reactive': indirect_reviver,
|
||||||
})
|
})
|
||||||
except (IndexError, TypeError, ValueError) as e:
|
except (IndexError, TypeError, ValueError) as e:
|
||||||
if default is not NO_DEFAULT:
|
if default is not NO_DEFAULT:
|
||||||
|
|||||||
Reference in New Issue
Block a user