mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-25 03:32:05 +00:00
[extractor/common] add transform_source kwargs to _search_json_ld()
This commit is contained in:
parent
a803582717
commit
5f48fc3d1d
1 changed files with 3 additions and 1 deletions
|
@ -1195,10 +1195,12 @@ class InfoExtractor(object):
|
||||||
# At the same time `default` may be passed that assumes `fatal=False`
|
# At the same time `default` may be passed that assumes `fatal=False`
|
||||||
# for _search_regex. Let's simulate the same behavior here as well.
|
# for _search_regex. Let's simulate the same behavior here as well.
|
||||||
fatal = kwargs.get('fatal', True) if default == NO_DEFAULT else False
|
fatal = kwargs.get('fatal', True) if default == NO_DEFAULT else False
|
||||||
|
# Give the caller extractor the opportunity to fix malformed JSON-LD.
|
||||||
|
transform_source = kwargs.get('transform_source', None)
|
||||||
json_ld = []
|
json_ld = []
|
||||||
for mobj in json_ld_list:
|
for mobj in json_ld_list:
|
||||||
json_ld_item = self._parse_json(
|
json_ld_item = self._parse_json(
|
||||||
mobj.group('json_ld'), video_id, fatal=fatal)
|
mobj.group('json_ld'), video_id, transform_source=transform_source, fatal=fatal)
|
||||||
if not json_ld_item:
|
if not json_ld_item:
|
||||||
continue
|
continue
|
||||||
if isinstance(json_ld_item, dict):
|
if isinstance(json_ld_item, dict):
|
||||||
|
|
Loading…
Reference in a new issue