# Dollar Hunter - NPM Package Search & Info (`chuckling_yarn/dollar-hunter-npm-scraper`) Actor

Search and get detailed info on NPM packages. Search by keyword, get package metadata, dependencies, download counts, and maintainer info. No API key required.

- **URL**: https://apify.com/chuckling\_yarn/dollar-hunter-npm-scraper.md
- **Developed by:** [Jonatan J. Martinez Collymoore](https://apify.com/chuckling_yarn) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.00005 / actor start

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## NPM Package Search & Download Stats

Search, inspect, and analyze NPM packages with zero configuration. Get package metadata, dependency trees, download statistics, and maintainer insights. **No API key or login required** — works directly with the public NPM Registry API.

### Features

| Mode | What it does | Output |
|------|-------------|--------|
| 🔍 `search` | Find packages by keyword with NPM scoring | Name, version, description, score (popularity/quality/maintenance), keywords, author, publisher, maintainers, repo URL |
| 📋 `package_info` | Full metadata for any package | Version, license, dependencies/devDependencies/peerDependencies, maintainers, readme excerpt, creation/modified dates, all versions, dist-tags |
| 📊 `downloads` | Download statistics | Weekly downloads, daily average, monthly estimate |
| 🔁 **Auto-retry** | 3 retries with exponential backoff | Reliable even during API rate limits |
| ⏱ **Profiling** | Built-in timing | Logs elapsed time per run |

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `mode` | `string` (select) | `search` | Operation mode: `search`, `package_info`, or `downloads` |
| `query` | `string` | `react` | Search keyword (search mode) or exact package name (other modes) |
| `maxResults` | `integer` | `25` | Max packages to return (1–100). Search mode only. |

#### Example Inputs

**Search for web frameworks:**
```json
{
  "mode": "search",
  "query": "web framework",
  "maxResults": 10
}
````

**Get full info on lodash:**

```json
{
  "mode": "package_info",
  "query": "lodash"
}
```

**Get download stats for express:**

```json
{
  "mode": "downloads",
  "query": "express"
}
```

### Output Schema

Each run produces a dataset with the following structure:

```json
{
  "mode": "search",
  "query": "web framework",
  "maxResults": 10,
  "totalResults": 10,
  "results": [
    {
      "name": "express",
      "version": "4.21.0",
      "description": "Fast, unopinionated, minimalist web framework...",
      "url": "https://www.npmjs.com/package/express",
      "homepage": "http://expressjs.com/",
      "repository": "git+https://github.com/expressjs/express.git",
      "author": "...",
      "publisher": "...",
      "maintainers": ["...", "..."],
      "keywords": ["web", "framework", "http", "..."],
      "date": "2024-08-15T...",
      "score": { "final": 0.9, "popularity": 0.9, "quality": 0.8, "maintenance": 0.9 },
      ...
    }
  ]
}
```

### Use Cases

| Use Case | Description |
|----------|-------------|
| 🛠 **Developer Tools Research** | Find the best packages by NPM quality/popularity scores for your next project |
| 🔒 **Dependency Audits** | Inspect dependency trees and maintainers for security reviews |
| 📈 **Market Intelligence** | Track download trends and popularity of competing packages |
| 🤖 **AI / ML Training Data** | Curate package metadata datasets for training code-aware models |
| 📋 **License Compliance** | Check licenses across package ecosystems |
| 🏗 **Migration Planning** | Compare alternatives before switching dependencies |

### FAQ

**Q: Do I need an NPM API key or token?**
A: No. This actor uses the public NPM Registry API which requires no authentication.

**Q: What rate limits apply?**
A: The NPM Registry API allows ~200 requests/min from a single IP. The actor includes automatic retry with exponential backoff.

**Q: Can I get download stats for multiple packages?**
A: Run the actor once per package in `downloads` mode, or use `search` to discover packages then batch runs programmatically.

**Q: How fresh is the data?**
A: Results come directly from the live NPM Registry API in real-time — no caching layer.

**Q: Does the actor work with scoped packages?**
A: Yes. Use the full package name including scope (e.g. `@angular/core`, `@nestjs/common`).

### Pricing

Pay per event — estimated cost:

| Mode | Typical cost per run |
|------|---------------------|
| `search` (10 results) | ~$0.001 |
| `search` (100 results) | ~$0.005 |
| `package_info` | ~$0.001 |
| `downloads` | ~$0.001 |

You only pay for successful runs.

### Changelog

- **v2.0** — Automatic retry with exponential backoff, console profiling, input validation, richer package\_info output (versions, dist-tags)
- **v1.0** — Initial release (search, package\_info, downloads modes)

# Actor input Schema

## `mode` (type: `string`):

Select what kind of NPM operation to perform:

- **search**: Search packages by keyword (returns scored results with popularity, quality, maintenance)
- **package\_info**: Get full metadata for a specific package (dependencies, maintainers, license, readme)
- **downloads**: Get weekly/daily download statistics for a package

## `query` (type: `string`):

For 'search' mode: keyword or phrase to find matching packages (e.g. 'web framework', 'database', 'ai').
For 'package\_info' or 'downloads' mode: exact NPM package name (e.g. 'express', 'lodash', 'react').

## `maxResults` (type: `integer`):

Maximum number of packages to return (1–100). Only applies to 'search' mode. Lower values run faster.

## Actor input object example

```json
{
  "mode": "search",
  "query": "react",
  "maxResults": 25
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "react"
};

// Run the Actor and wait for it to finish
const run = await client.actor("chuckling_yarn/dollar-hunter-npm-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "react" }

# Run the Actor and wait for it to finish
run = client.actor("chuckling_yarn/dollar-hunter-npm-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "react"
}' |
apify call chuckling_yarn/dollar-hunter-npm-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=chuckling_yarn/dollar-hunter-npm-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Dollar Hunter - NPM Package Search & Info",
        "description": "Search and get detailed info on NPM packages. Search by keyword, get package metadata, dependencies, download counts, and maintainer info. No API key required.",
        "version": "2.0",
        "x-build-id": "iEA9yCnXhLKeQPNg8"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/chuckling_yarn~dollar-hunter-npm-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-chuckling_yarn-dollar-hunter-npm-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/chuckling_yarn~dollar-hunter-npm-scraper/runs": {
            "post": {
                "operationId": "runs-sync-chuckling_yarn-dollar-hunter-npm-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/chuckling_yarn~dollar-hunter-npm-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-chuckling_yarn-dollar-hunter-npm-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Search Mode",
                        "enum": [
                            "search",
                            "package_info",
                            "downloads"
                        ],
                        "type": "string",
                        "description": "Select what kind of NPM operation to perform:\n- **search**: Search packages by keyword (returns scored results with popularity, quality, maintenance)\n- **package_info**: Get full metadata for a specific package (dependencies, maintainers, license, readme)\n- **downloads**: Get weekly/daily download statistics for a package",
                        "default": "search"
                    },
                    "query": {
                        "title": "Search Query or Package Name",
                        "type": "string",
                        "description": "For 'search' mode: keyword or phrase to find matching packages (e.g. 'web framework', 'database', 'ai').\nFor 'package_info' or 'downloads' mode: exact NPM package name (e.g. 'express', 'lodash', 'react').",
                        "default": "react"
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum number of packages to return (1–100). Only applies to 'search' mode. Lower values run faster.",
                        "default": 25
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
