fetch-doc

0.0.1 • Public • Published

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

Star

License

This projet is licensed under the terms of MIT License

Package Sidebar

Install

npm i fetch-doc

Weekly Downloads

5

Version

0.0.1

License

MIT

Unpacked Size

8.26 kB

Total Files

11

Last publish

Collaborators

  • zakarialaoui10