1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-17 06:35:42 +07:00

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

Authored by: seproDev
This commit is contained in:
sepro
2025-04-06 20:31:00 +02:00
committed by GitHub
parent db6d1f145a
commit 45f01de00e

View File

@@ -1570,6 +1570,8 @@ def _yield_json_ld(self, html, video_id, *, fatal=True, default=NO_DEFAULT):
"""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,