[ie] Make _search_nuxt_data
more lenient
Authored by: std-move Co-authored-by: std-move <26625259+std-move@users.noreply.github.com>
This commit is contained in:
parent
52414d64ca
commit
904a19ee93
1 changed files with 1 additions and 1 deletions
|
@ -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'),
|
||||||
|
|
Loading…
Reference in a new issue