aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorLauren Liberda <laura@selfisekai.rocks>2021-10-23 04:02:23 +0200
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-10 06:11:05 +0530
commitf98709af3100b562a053331fd52612acc99e1d6d (patch)
tree9fb6fc857a95f2c9553fb6d1d6ef9da76dcc2734 /yt_dlp/extractor/common.py
parentc586f9e8dee3c6f2aac10e828751cac592b6ba14 (diff)
downloadhypervideo-pre-f98709af3100b562a053331fd52612acc99e1d6d.tar.lz
hypervideo-pre-f98709af3100b562a053331fd52612acc99e1d6d.tar.xz
hypervideo-pre-f98709af3100b562a053331fd52612acc99e1d6d.zip
[extractor] Add `_search_nextjs_data` (#1386)
Authored by: selfisekai
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py7
1 files changed, 7 insertions, 0 deletions
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)<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)</script>',
+ webpage, 'next.js data', **kw),
+ video_id, **kw)
+
@staticmethod
def _hidden_inputs(html):
html = re.sub(r'<!--(?:(?!<!--).)*-->', '', html)