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 🙏

© 2025 – Pkg Stats / Ryan Hefner

skrape-js

v1.0.7

Published

TypeScript/Node.js SDK for the Skrape.ai API with type-safe schema validation

Readme

skrape-js

A TypeScript library for easily interacting with Skrape.ai API. Define your scraping schema using Zod and get type-safe results.

Features

  • 🛡️ Type-safe: Define your schemas using Zod and get fully typed results
  • 🚀 Simple API: Just define a schema and get your data
  • 🧩 Minimal Dependencies
  • 📝 Markdown Conversion: Convert web pages to markdown
  • 🕷️ Web Crawling: Crawl websites with configurable depth and limits

Installation

# Using npm
npm install skrape-js zod

# Using yarn, pnpm, etc.
yarn/pnpm/bun add skrape-js zod

Note: zod is a peer dependency and must be installed alongside skrape-js.

Environment Setup

Setup your API key in .env:

SKRAPE_API_KEY="your_api_key_here"

Get your API key on Skrape.ai

Quick Start

import { Skrape } from "skrape-js";
import { z } from "zod";

// Initialize the client
const skrape = new Skrape({
  apiKey: process.env.SKRAPE_API_KEY,
});

// Define your schema using Zod
const newsSchema = z.object({
  topStories: z
    .array(
      z.object({
        title: z.string(),
        url: z.string(),
        score: z.number(),
        author: z.string(),
        commentCount: z.number(),
      })
    )
    .max(3),
});

// Extract data
const result = await skrape.extract(
  "https://news.ycombinator.com",
  newsSchema,
  { renderJs: false }
);

console.log(result.topStories);
// [
//   {
//     title: "Example HN Post",
//     url: "https://example.com",
//     score: 100,
//     author: "user123",
//     commentCount: 25
//   },
//   ...
// ]

Features

Data Extraction

Extract structured data from any webpage using Zod schemas:

const productSchema = z.object({
  name: z.string(),
  price: z.number(),
  description: z.string(),
});

const product = await skrape.extract("https://shop.com/product", productSchema);

Markdown Conversion

Convert a single web page to markdown:

const markdown = await skrape.markdown(
  "https://example.com",
  { renderJs: true }
);

console.log(markdown);
// # Example Page
// 
// This is the content...

Convert multiple web pages to markdown in bulk:

const { jobId } = await skrape.markdown.bulk(
  ["https://example.com", "https://example.org"],
  { renderJs: true, callbackUrl: "https://webhook.site/callback" }
);

// Check job status
const status = await skrape.getJobStatus(jobId);
if (status.isCompleted) {
  console.log(status.output);
}

Web Crawling

Crawl websites with configurable options:

const { jobId } = await skrape.crawl(
  ["https://example.com"],
  {
    renderJs: true,
    maxDepth: 3,
    maxPages: 100,
    maxLinks: 100,
    linksOnly: false
  }
);

// Check crawl results
const status = await skrape.getJobStatus(jobId);
if (status.isCompleted) {
  console.log(status.output);
}

Health Check

Check API health status:

const health = await skrape.checkHealth();
console.log(health.status); // 'healthy' | 'unhealthy'

Error Handling

The library throws typed errors that you can catch and handle:

try {
  const result = await skrape.extract(url, schema);
} catch (error) {
  if (error instanceof SkrapeError) {
    console.error("Error:", error.message);
    console.error("Status:", error.status);
    if (error.retryAfter) {
      console.error("Retry after:", error.retryAfter, "seconds");
    }
  }
}