mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-01 23:25:14 +00:00
harden regex with lookbehind
This commit is contained in:
@@ -1495,8 +1495,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
|
||||
def _get_yt_initial_data(self, video_id, webpage):
|
||||
config = self._search_regex(
|
||||
(r'window\["ytInitialData"\]\s*=\s*(.*);',
|
||||
r'var\s+ytInitialData\s*=\s*(.*?);'),
|
||||
(r'window\["ytInitialData"\]\s*=\s*(.*?)(?<=});',
|
||||
r'var\s+ytInitialData\s*=\s*(.*?)(?<=});'),
|
||||
webpage, 'ytInitialData', default=None)
|
||||
if config:
|
||||
return self._parse_json(
|
||||
|
||||
Reference in New Issue
Block a user