Check if '@context' is present in JSON-LD to avoid crash

This commit is contained in:
aeph6Ee0 2018-04-06 19:48:36 +02:00
parent 1951bc12dc
commit 6c33309a3f

View File

@ -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