|
|
@ -1687,7 +1687,7 @@ class InfoExtractor:
|
|
|
|
def _search_nuxt_data(self, webpage, video_id, context_name='__NUXT__', *, fatal=True, traverse=('data', 0)):
|
|
|
|
def _search_nuxt_data(self, webpage, video_id, context_name='__NUXT__', *, fatal=True, traverse=('data', 0)):
|
|
|
|
"""Parses Nuxt.js metadata. This works as long as the function __NUXT__ invokes is a pure function"""
|
|
|
|
"""Parses Nuxt.js metadata. This works as long as the function __NUXT__ invokes is a pure function"""
|
|
|
|
rectx = re.escape(context_name)
|
|
|
|
rectx = re.escape(context_name)
|
|
|
|
FUNCTION_RE = r'\(function\((?P<arg_keys>.*?)\){return\s+(?P<js>{.*?})\s*;?\s*}\((?P<arg_vals>.*?)\)'
|
|
|
|
FUNCTION_RE = r'\(function\((?P<arg_keys>.*?)\){(?:.*?)return\s+(?P<js>{.*?})\s*;?\s*}\((?P<arg_vals>.*?)\)'
|
|
|
|
js, arg_keys, arg_vals = self._search_regex(
|
|
|
|
js, arg_keys, arg_vals = self._search_regex(
|
|
|
|
(rf'<script>\s*window\.{rectx}={FUNCTION_RE}\s*\)\s*;?\s*</script>', rf'{rectx}\(.*?{FUNCTION_RE}'),
|
|
|
|
(rf'<script>\s*window\.{rectx}={FUNCTION_RE}\s*\)\s*;?\s*</script>', rf'{rectx}\(.*?{FUNCTION_RE}'),
|
|
|
|
webpage, context_name, group=('js', 'arg_keys', 'arg_vals'),
|
|
|
|
webpage, context_name, group=('js', 'arg_keys', 'arg_vals'),
|
|
|
|