Skip to content

A feature-rich command-line audio/video downloader

[youtube] Bugfix in `_extract_ytcfg`

pukkandan8c54a3051df9
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 940f3def2f..eaa2db1da8 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -356,6 +356,8 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
return data.get('DELEGATED_SESSION_ID')
def _extract_ytcfg(self, video_id, webpage):
+ if not webpage:
+ return {}
return self._parse_json(
self._search_regex(
r'ytcfg\.set\s*\(\s*({.+?})\s*\)\s*;', webpage, 'ytcfg',