From: Yen Chi Hsuan Date: Sat, 16 Jan 2016 12:45:36 +0000 (+0800) Subject: [extractor/common] Allow passing more parameters to _search_json_ld X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=0b26ba3fc8eee0bb047c5e78e6f1a8ba59fa9457;p=youtube-dl.git [extractor/common] Allow passing more parameters to _search_json_ld --- diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 92e2e4f43..8da70ae14 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -763,13 +763,13 @@ class InfoExtractor(object): return self._html_search_meta('twitter:player', html, 'twitter card player') - def _search_json_ld(self, html, video_id, fatal=True): + def _search_json_ld(self, html, video_id, **kwargs): json_ld = self._search_regex( r'(?s)]+type=(["\'])application/ld\+json\1[^>]*>(?P.+?)', - html, 'JSON-LD', fatal=fatal, group='json_ld') + html, 'JSON-LD', group='json_ld', **kwargs) if not json_ld: return {} - return self._json_ld(json_ld, video_id, fatal=fatal) + return self._json_ld(json_ld, video_id, fatal=kwargs.get('fatal', True)) def _json_ld(self, json_ld, video_id, fatal=True): if isinstance(json_ld, compat_str):