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

akbdsdk

v1.0.8

Published

A simple Node.js SDK for the Bright Data API

Readme

AKBD SDK

A simple Node.js SDK for the Bright Data API.

Installation

npm install akbdsdk

Quick Start

  1. Create a new file example.js:
const { BrightDataClient } = require('akbdsdk');

// STEP 1: Initialize the client with your API key
// Replace 'your-api-key-here' with your actual Bright Data API key
const client = new BrightDataClient({
  apiKey: 'your-api-key-here'
});

async function scrapeWebsite() {
  try {
    // STEP 2: Trigger the collection
    // Replace 'your-dataset-id' with your actual Bright Data Dataset ID
    const triggerResponse = await client.triggerCollection({
      dataset_id: 'your-dataset-id',
      urls: [{
        // Replace these values with your target website and requirements
        url: 'https://www.example.com',
        prompt: 'Extract all content',
        country: 'US'
      }]
    });

    console.log('Collection started. Snapshot ID:', triggerResponse.snapshot_id);

    // STEP 3: Wait for the snapshot to be ready
    const status = await client.waitForSnapshot(triggerResponse.snapshot_id, {
      maxAttempts: 10,
      delayMs: 30000,
      onProgress: (status) => {
        console.log('Progress:', {
          pages_crawled: status.progress?.pages_crawled || 0,
          pages_extracted: status.progress?.pages_extracted || 0,
          pages_failed: status.progress?.pages_failed || 0
        });
      }
    });

    console.log('Snapshot is ready:', status.status);

    // STEP 4: Download the results
    const results = await client.downloadSnapshot({
      job_id: triggerResponse.snapshot_id,
      format: 'json'
    });

    console.log('Scraping completed successfully!');
    console.log('Results URL:', results.url);
    return results;

  } catch (error) {
    console.error('Error:', error);
    throw error;
  }
}

// Run the example
scrapeWebsite().catch(console.error);
  1. Update the following values in the code:

    • Replace 'your-api-key-here' with your Bright Data API key
    • Replace 'your-dataset-id' with your Bright Data Dataset ID
    • Update the URL, prompt, and country code as needed
  2. Run the example:

node example.js

Step-by-Step Guide

  1. STEP 1: Initialize the Client

    • Create a connection to the Bright Data API
    • Replace the API key with your actual key
  2. STEP 2: Trigger Collection

    • Start the scraping process
    • Set your dataset ID and target website details
  3. STEP 3: Wait for Snapshot

    • Monitor the scraping progress
    • See real-time updates on pages crawled and extracted
  4. STEP 4: Download Results

    • Get the URL to access your scraped data
    • Data is available in JSON format

Troubleshooting

If you encounter errors, here are some common issues and solutions:

  1. API Key Issues

    // Make sure your API key is correct and properly formatted
    const client = new BrightDataClient({
      apiKey: 'your-api-key-here' // Should be a valid Bright Data API key
    });
    • Verify the API key in your Bright Data dashboard
    • Ensure the key has the necessary permissions
    • Check if the key is properly formatted (no extra spaces or quotes)
  2. Dataset ID Issues

    // Verify your dataset ID exists and is correct
    const triggerResponse = await client.triggerCollection({
      dataset_id: 'your-dataset-id' // Should be a valid dataset ID
    });
    • Check the dataset ID in your Bright Data dashboard
    • Ensure the dataset is properly configured
    • Verify the dataset is active and accessible
  3. API Endpoint Issues

    • Check if you can reach the Bright Data API:
    curl -I https://api.brightdata.com
    • Verify your network connection
    • Check if your firewall allows outbound HTTPS connections
    • Ensure you're using the correct API endpoint
  4. Common Error Messages

    • "API key is required" - You forgot to provide an API key
    • "Dataset ID is required" - You forgot to provide a dataset ID
    • "No response received" - Network connectivity issue
    • "Unknown error occurred" - Check the API response details in the logs
    • "Invalid API key" - Your API key is not valid
    • "Dataset not found" - Your dataset ID is incorrect
  5. Debugging Tips

    • Enable verbose logging in your application
    • Check the network tab in your browser's developer tools
    • Verify the request payload matches the API requirements
    • Test the API endpoint with a tool like Postman or curl

Error Handling

The SDK throws errors with descriptive messages. Always wrap your calls in try-catch blocks:

try {
  const results = await scrapeWebsite();
  console.log(results);
} catch (error) {
  console.error('Scraping failed:', error);
  // Additional error details are logged automatically
}

License

MIT