From 6c33309a3f2777ed735298e1a590ced60cc81a18 Mon Sep 17 00:00:00 2001 From: aeph6Ee0 Date: Fri, 6 Apr 2018 19:48:36 +0200 Subject: [PATCH] Check if '@context' is present in JSON-LD to avoid crash --- youtube_dl/extractor/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 3fc6e21da..c3a4dccaf 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -1025,7 +1025,7 @@ class InfoExtractor(object): }) for e in json_ld: - if re.match(r'^https?://schema.org/?$', e.get('@context')): + if '@context' in e and re.match(r'^https?://schema.org/?$', e.get('@context')): item_type = e.get('@type') if expected_type is not None and expected_type != item_type: return info