npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

anyscrape

v1.0.9

Published

Scrape any public data with ease

Readme

Anyscrape

Scrape any public data with ease

Purpose

The first step to write a typical web scraper is to identify which element to scrape. As a result, an immense amount of work is done to research the structure of the web. Even worse, some websites have dynamically changing information on html elements or structures that are unfriendly to web scrapers.

The library is intended to circumvent anti-scraping structures, and simplify the process of web scraping by leaving a large room of customization.

To simplify the configuration of the web scraper, anyscrape-reader is a GUI application that allows intuitive element selection, and generation of filters.

Usage

1.) Initialize the scraper class

const { Scraper } = require("anyscrape");

async function main() {
    let scraper = new Scraper();
    await scraper.init();
}

2.) Load configuration

The configuration is generated as a json file by Anyscrape reader. This specifies which element for anyscrape to fetch.

Load json configuration file

await scraper.load_config_file("filepath.json");

or load dictionary object

await scraper.load_config(dictionary);

3.) Web scraping

With configuration imported, the next step is to scrape a website.

Get html objects selected as a string array

let selected_elements = await scraper.scrape(url);

Since a string array is returned, it is recommended to use other html parsing library for further manipulation, such as node-html-parser

Examples

Fetch headlines from nbcnews.com

config.json:

{
    "filters": {
        "tag_name_filter": "span",
        "class_filter": "tease-card__headline"
    },
    "scrape_delay": 0
}

index.js:

const { Scraper } = require("anyscrape");
const parser = require("node-html-parser");
const path = require("path");

async function fetch_news() {
    let url = "https://www.nbcnews.com/";
    let scraper = new Scraper();
    await scraper.init();

    await scraper.load_config_file(path.resolve("config.json"));
    let selected_elements = await scraper.scrape(url);

    console.log("Headlines from nbcnews: \n");
    for (let element of selected_elements) {
        let parsed = parser.parse(element);
        console.log('\x1b[36m%s\x1b[0m', parsed.textContent + "\n");
    }
}

for more examples, see examples