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

@xcrawl/xcrawl

v1.0.0

Published

Official Node.js SDK for XCrawl - A powerful web scraping API service

Readme

XCrawl Node SDK

XCrawl Node SDK provides an interface to the XCrawl API, including scraping, search, sitemap discovery, and site crawling.

Table of Contents

Installation

npm install @xcrawl/xcrawl

Quick Start

  1. Get an API key from xcrawl.com.
  2. Set XCRAWL_API_KEY or pass apiKey directly.
export XCRAWL_API_KEY=your-api-key
import { XcrawlClient } from '@xcrawl/xcrawl';

const client = new XcrawlClient();

// Sync scrape
const syncResult = await client.scrape('https://example.com', {
  output: { formats: ['markdown'] }
});
console.log(syncResult.data.markdown);

// Async scrape + auto polling
const job = await client.scrape('https://example.com', {
  mode: 'async',
  output: { formats: ['markdown', 'summary'] }
});
const result = await client.waitForJob(job.scrape_id, { timeout: 60 });
console.log(result.status);

Core APIs

Scrape

const result = await client.scrape('https://example.com', {
  proxy: { location: 'US' },
  request: {
    device: 'desktop',
    only_main_content: true,
    block_ads: true,
  },
  output: {
    formats: ['html', 'markdown', 'links', 'screenshot'],
    screenshot: 'full_page'
  }
});

Async Status Check

const status = await client.getJobResult('scrape-id-123');
if (status.status === 'completed') {
  console.log(status.data.markdown);
} else if (status.status === 'failed') {
  console.error(status.message);
}

Structured Extraction (json format)

output.json.prompt and output.json.json_schema are both optional.

const result = await client.scrape('https://example.com', {
  output: {
    formats: ['json'],
    json: {
      prompt: 'Extract product name and price',
      json_schema: {
        type: 'object',
        properties: {
          name: { type: 'string' },
          price: { type: 'number' }
        }
      }
    }
  }
});

Search

const result = await client.search({
  query: 'web scraping',
  location: 'New York, NY',
  language: 'en',
  limit: 10
});
console.log(result.data.organic_results);

Map

const result = await client.map('https://example.com', {
  filter: '.*\\.html$',
  limit: 1000,
  include_subdomains: true,
  ignore_query_parameters: true
});
console.log(result.data.links);

Crawl

const job = await client.crawl('https://example.com', {
  crawler: {
    limit: 100,
    max_depth: 3,
    include: ['.*\\.html$'],
    exclude: ['.*\\/admin\\/.*']
  },
  output: { formats: ['markdown'] }
});

const crawlStatus = await client.getCrawlStatus(job.crawl_id);
console.log(crawlStatus.status);

Webhook (Async)

await client.scrape('https://example.com', {
  mode: 'async',
  webhook: {
    url: 'https://your-server.com/webhook',
    events: ['completed', 'failed']
  }
});

Configuration

const client = new XcrawlClient({
  apiKey: 'your-api-key',
  apiUrl: 'https://run.xcrawl.com',
  timeout: 60,
  maxRetries: 3,
  backoffFactor: 0.5,
});

Retry behavior:

  • Retries: HTTP 5xx and network failures
  • No retry: HTTP 4xx and validation errors

Output Formats

Supported values in output.formats:

  • markdown
  • html
  • raw_html
  • links
  • summary
  • screenshot
  • json

If output.formats is omitted or set to [], the response returns metadata only.

Error Handling

import { XcrawlClient, XcrawlError, JobTimeoutError } from '@xcrawl/xcrawl';

const client = new XcrawlClient({ apiKey: 'your-api-key' });

try {
  const result = await client.scrape('https://example.com', {
    output: { formats: ['markdown'] }
  });
  console.log(result.data.markdown);
} catch (error) {
  if (error instanceof JobTimeoutError) {
    console.error(`Job ${error.jobId} timed out after ${error.timeoutSeconds}s`);
  } else if (error instanceof XcrawlError) {
    console.error(error.code, error.message, error.status, error.request_id);
  }
}

TypeScript Support

The package ships with built-in TypeScript types.

import type {
  ScrapeOptions,
  SearchOptions,
  MapOptions,
  CrawlOptions,
  XcrawlError,
  JobTimeoutError,
} from '@xcrawl/xcrawl';

Requirements

  • Node.js >= 14.0.0

License

MIT