1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00
Authored by: bashonly
This commit is contained in:
bashonly 2025-06-09 09:37:39 -05:00
parent 291301e939
commit e6133732c7
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

View File

@ -1795,14 +1795,13 @@ def _search_nuxt_data(self, webpage, video_id, context_name='__NUXT__', *, fatal
ret = self._parse_json(js, video_id, transform_source=functools.partial(js_to_json, vars=args), fatal=fatal)
return traverse_obj(ret, traverse) or {}
def _search_nuxt_json(self, webpage, video_id, script_id='__NUXT_DATA__', *, fatal=True,
traverse=('data', ..., {dict}, any), allow_recursion=100):
def _search_nuxt_json(self, webpage, video_id, *, fatal=True, traverse=('data', ..., {dict}, any), allow_recursion=100):
"""Parses Nuxt.js metadata when it has already been rendered into a JSON array"""
ERROR_MSG = 'Unable to extract NUXT JSON data'
array = self._search_json(
fr'<script\b[^>]+\bid="{re.escape(script_id)}"[^>]*>', webpage, script_id,
video_id, contains_pattern=r'\[(?s:.+)\]', default=NO_DEFAULT if fatal else [{}])
r'<script\b[^>]+\bid="__NUXT_DATA__"[^>]*>', webpage, 'nuxt data', video_id,
contains_pattern=r'\[(?s:.+)\]', default=NO_DEFAULT if fatal else [{}])
def extract_element(element, allow_recursion):
if allow_recursion < 0: