From f98709af3100b562a053331fd52612acc99e1d6d Mon Sep 17 00:00:00 2001 From: Lauren Liberda Date: Sat, 23 Oct 2021 04:02:23 +0200 Subject: [PATCH] [extractor] Add `_search_nextjs_data` (#1386) Authored by: selfisekai --- yt_dlp/extractor/common.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 7500402fa..5c6e59901 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -1496,6 +1496,13 @@ class InfoExtractor(object): break return 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)]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)', + webpage, 'next.js data', **kw), + video_id, **kw) + @staticmethod def _hidden_inputs(html): html = re.sub(r'', '', html)