A feature-rich command-line audio/video downloader
[extractor] Add `_search_nextjs_data` (#1386) Authored by: selfisekai
Lauren Liberdaf98709af3100
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.pyindex 7500402fae..5c6e599017 100644--- a/yt_dlp/extractor/common.py+++ b/yt_dlp/extractor/common.py@@ -1496,6 +1496,13 @@ class InfoExtractor(object):breakreturn dict((k, v) for k, v in info.items() if v is not None)+ def _search_nextjs_data(self, webpage, video_id, **kw):+ return self._parse_json(+ self._search_regex(+ r'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)</script>',+ webpage, 'next.js data', **kw),+ video_id, **kw)+@staticmethoddef _hidden_inputs(html):html = re.sub(r'<!--(?:(?!<!--).)*-->', '', html)