fetch-doc
v0.0.1
Published
fetch and parse HTML documents asynchronously and synchronously
Downloads
7
Maintainers
Readme
FetchDoc is a JavaScript module for fetching and parsing HTML documents asynchronously and synchronously.
Installation
You can install FetchDoc via npm :
npm i fetch-doc
Usage
Asynchronous Fetch and Parse
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))
Synchronous Fetch and Parse
To perform an asynchronous fetch and parse of an HTML document :
import FetchDoc from "fetch-doc"
const dcument=FetchDoc.sync("https://github.com/zakarialaoui10")
console.log(document.querySelector("[data-bio-text]").textContent)
Fetch and Parse All Asynchronously
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))
Fetch and Parse All Synchronously
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"
)
⭐️ Show your support
If you've found the library helpful, show your support by giving it a star! Your feedback means a lot
License
This projet is licensed under the terms of MIT License