Skip to content

Commit

Permalink
Merge pull request #361 from extractus/8.0.2
Browse files Browse the repository at this point in the history
v8.0.2
  • Loading branch information
ndaidong authored Aug 16, 2023
2 parents fc63f10 + 9355b4e commit b9cb636
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion src/utils/linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/transformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
}

0 comments on commit b9cb636

Please sign in to comment.