New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fetch-doc

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-doc

fetch and parse HTML documents asynchronously and synchronously

0.0.1
latest
Source
npm
Version published
Weekly downloads
18
800%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

scrapping

FAQs

Package last updated on 01 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts