Skip to content

zakarialaoui10/fetch-doc

Repository files navigation

fetch-doc is a JavaScript module for fetching and parsing HTML documents asynchronously and synchronously.

Installation

You can install fetch-doc 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 document=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

Star

License

This projet is licensed under the terms of MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published