From 6f55d94777187189f353efb03269840df9691b06 Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 16 Aug 2023 11:00:11 +0700 Subject: [PATCH 1/3] Update dependencies --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 46135320..54f621ea 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "8.0.1", + "version": "8.0.2", "name": "@extractus/article-extractor", "description": "To extract main article from given URL", "homepage": "https://github.com/extractus/article-extractor", @@ -38,9 +38,9 @@ }, "devDependencies": { "@types/sanitize-html": "^2.9.0", - "eslint": "^8.45.0", + "eslint": "^8.47.0", "https-proxy-agent": "^7.0.1", - "jest": "^29.6.1", + "jest": "^29.6.2", "nock": "^13.3.2" }, "keywords": [ From c0c7c1d0876ce391406612ef78575885f6fca09e Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 16 Aug 2023 11:04:12 +0700 Subject: [PATCH 2/3] Use `childNodes` instead of `children` To get it work as same as Deno DOM --- src/utils/linker.js | 2 +- src/utils/transformation.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/linker.js b/src/utils/linker.js index 666b2531..9cbe837b 100644 --- a/src/utils/linker.js +++ b/src/utils/linker.js @@ -124,7 +124,7 @@ export const normalize = (html, url) => { } }) - return Array.from(doc.children).map(element => element.outerHTML).join('') + return Array.from(doc.childNodes).map(element => element.outerHTML).join('') } export const getDomain = (url) => { diff --git a/src/utils/transformation.js b/src/utils/transformation.js index d97a6720..9ec2d9ef 100644 --- a/src/utils/transformation.js +++ b/src/utils/transformation.js @@ -59,11 +59,11 @@ export const findTransformations = (links) => { export const execPreParser = (html, links) => { const doc = new DOMParser().parseFromString(html, 'text/html') findTransformations(links).map(tfm => tfm.pre).filter(fn => isFunction(fn)).map(fn => fn(doc)) - return Array.from(doc.children).map(it => it.outerHTML).join('') + return Array.from(doc.childNodes).map(it => it.outerHTML).join('') } export const execPostParser = (html, links) => { const doc = new DOMParser().parseFromString(html, 'text/html') findTransformations(links).map(tfm => tfm.post).filter(fn => isFunction(fn)).map(fn => fn(doc)) - return Array.from(doc.children).map(it => it.outerHTML).join('') + return Array.from(doc.childNodes).map(it => it.outerHTML).join('') } From 9355b4e2c8729c8b4a5b1577c515811cfc36c21a Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 16 Aug 2023 11:07:45 +0700 Subject: [PATCH 3/3] Update README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index d511b34d..618759d1 100644 --- a/README.md +++ b/README.md @@ -508,6 +508,17 @@ pnpm eval {URL_TO_PARSE_ARTICLE} ``` ## License + The MIT License (MIT) +## Support the project + +If you find value from this open source project, you can support in the following ways: + +- Give it a star ⭐ +- Buy me a coffee: https://paypal.me/ndaidong 🍵 +- Subscribe [Article Extractor service](https://rapidapi.com/pwshub-pwshub-default/api/article-extractor2) on RapidAPI 😉 + +Thank you. + ---