Skip to content

Commit

Permalink
Merge pull request #411 from extractus/8.0.15
Browse files Browse the repository at this point in the history
v8.0.15
  • Loading branch information
ndaidong authored Oct 26, 2024
2 parents 6355d23 + bc624f2 commit e15b3af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node_version: [18.x, 20.x, 22.x]
node_version: [18.x, 20.x, 22.x, 23.x]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "8.0.14",
"version": "8.0.15",
"name": "@extractus/article-extractor",
"description": "To extract main article from given URL",
"homepage": "https://github.com/extractus/article-extractor",
Expand Down Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"@types/sanitize-html": "^2.13.0",
"eslint": "^9.12.0",
"eslint": "^9.13.0",
"globals": "^15.11.0",
"https-proxy-agent": "^7.0.5",
"nock": "^13.5.5"
Expand Down
5 changes: 3 additions & 2 deletions src/utils/extractLdSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const parseJson = (text) => {
try {
return JSON.parse(text)
} catch {
return null
return {}
}
}

Expand All @@ -59,7 +59,8 @@ export default (document, entry) => {
const ldSchemas = document.querySelectorAll('script[type="application/ld+json"]')
ldSchemas.forEach(ldSchema => {
const ldJson = parseJson(ldSchema.textContent.replace(/[\n\r\t]/g, ''))
const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type']?.toLowerCase())
const ldJsonType = ldJson['@type']?.toLowerCase() || null
const isAllowedLdJsonType = ldJsonType ? typeSchemas.includes(ldJsonType) : false

if (ldJson && isAllowedLdJsonType) {
Object.entries(attributeLists).forEach(([key, attr]) => {
Expand Down

0 comments on commit e15b3af

Please sign in to comment.