fetch-doc is a JavaScript module for fetching and parsing HTML documents asynchronously and synchronously.
You can install fetch-doc via npm :
npm i fetch-doc
To perform an asynchronous fetch and parse of an HTML document :
import FetchDoc from "fetch-doc"
FetchDoc.async("https://github.com/zakarialaoui10")
.then(e=>e.querySelector("[data-bio-text]").textContent)
.then(e=>console.log(e))
To perform an asynchronous fetch and parse of an HTML document :
import FetchDoc from "fetch-doc"
const document=FetchDoc.sync("https://github.com/zakarialaoui10")
console.log(document.querySelector("[data-bio-text]").textContent)
To fetch and parse multiple HTML documents asynchronously :
import FetchDoc from "fetch-doc"
FetchDoc.all(
"https://github.com/zakarialaoui10",
"https://github.com/ABDELLK-ai"
)
.then(e=>e.map(n=>n.querySelector("[data-bio-text]").textContent))
.then(e=>console.log(e))
To fetch and parse multiple HTML documents synchronously :
import FetchDoc from "fetch-doc"
const document=FetchDoc.allSync(
"https://github.com/zakarialaoui10",
"https://github.com/ABDELLK-ai"
)
If you've found the library helpful, show your support by giving it a star! Your feedback means a lot