diff --git a/package.json b/package.json index b500351..7ed222e 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "8.0.11", + "version": "8.0.12", "name": "@extractus/article-extractor", "description": "To extract main article from given URL", "homepage": "https://github.com/extractus/article-extractor", diff --git a/src/utils/extractLdSchema.js b/src/utils/extractLdSchema.js index b74ebd8..6077331 100644 --- a/src/utils/extractLdSchema.js +++ b/src/utils/extractLdSchema.js @@ -56,7 +56,7 @@ export default (document, entry) => { ldSchemas.forEach(ldSchema => { const ldJson = parseJson(ldSchema.textContent.replace(/[\n\r\t]/g, '')) - const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type'].toLowerCase()) + const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type']?.toLowerCase()) if (ldJson && isAllowedLdJsonType) { Object.entries(attributeLists).forEach(([key, attr]) => { diff --git a/test-data/regular-article-json-ld.html b/test-data/regular-article-json-ld.html index 5c9cda7..c48ad9d 100644 --- a/test-data/regular-article-json-ld.html +++ b/test-data/regular-article-json-ld.html @@ -12,6 +12,27 @@ +