Skip to content

A feature-rich command-line audio/video downloader

[utils] `_yield_json_ld`: Make function less fatal (#12855)

sepro45f01de00e1b
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 4c1bc4cf47..d5607296df 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1570,6 +1570,8 @@ class InfoExtractor:
"""Yield all json ld objects in the html"""
if default is not NO_DEFAULT:
fatal = False
+ if not fatal and not isinstance(html, str):
+ return
for mobj in re.finditer(JSON_LD_RE, html):
json_ld_item = self._parse_json(
mobj.group('json_ld'), video_id, fatal=fatal,