# npm Packages Search Scraper (`fetch_cat/npm-packages-search-scraper`) Actor

Search npm packages and export registry metadata, popularity scores, maintainers, repository links, and download counts.

- **URL**: https://apify.com/fetch\_cat/npm-packages-search-scraper.md
- **Developed by:** [Hanna Nosova](https://apify.com/fetch_cat) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.07 / 1,000 package results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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 Packages Search Scraper

Search npm packages and export public registry metadata, popularity scores, maintainer usernames, repository links, and download-count snapshots. The Actor uses npm's public registry and downloads APIs, so it is fast, browserless, and suitable for scheduled monitoring.

Use it for software supply-chain research, developer ecosystem analysis, DevRel/content planning, dependency shortlist exports, and package popularity reports.

### At a glance

- **Primary job**: Turn npm search terms or known package names into structured package rows.
- **Input**: A keyword query, direct package names, result limit, and optional download-count enrichment.
- **Output**: One dataset row per npm package with metadata, links, scores, maintainers, downloads, and status.
- **Best for**: Package discovery, dependency monitoring, supply-chain shortlist exports, and recurring data snapshots.

### Common workflows

- **Find packages by topic**: Search keywords such as `react`, `eslint plugin`, or `date formatting` and export ranked packages.
- **Monitor known dependencies**: Fetch packages such as `react`, `vite`, and `typescript` on a schedule and compare download-count snapshots.
- **Build supply-chain shortlists**: Export repository links, maintainer usernames, scores, and popularity metrics before manual review.
- **Automate reporting**: Send Apify dataset exports to CSV, JSON, Excel, webhooks, API clients, or MCP-compatible AI agents.

### Input recipes

- **Small smoke test**: `query: "react"`, `maxItems: 10`, `includeDownloads: true`.
- **Known-package monitoring**: `packageNames: ["react", "vite", "typescript"]`, `includeDownloads: true`.
- **Supply-chain shortlist**: `query: "eslint plugin"`, `maxItems: 100`, `includeMaintainers: true`, `dedupe: true`.

### What data can you extract?

| Field | Description |
| --- | --- |
| `packageName` | npm package name, including scope when present. |
| `scope` | Scope such as `@types`, or `null` for unscoped packages. |
| `version` | Latest package version from npm. |
| `description`, `keywords`, `license` | Public package metadata when available. |
| `publisherUsername`, `maintainerUsernames` | Public npm usernames exposed by registry/search responses. |
| `weeklyDownloads`, `monthlyDownloads`, `downloadsLastMonth` | Download metrics from npm search/download APIs. |
| `dependents` | Dependent count when returned by npm search. |
| `scoreFinal`, `scorePopularity`, `scoreQuality`, `scoreMaintenance`, `searchScore` | npm search ranking and score signals. |
| `homepageUrl`, `repositoryUrl`, `bugsUrl`, `npmUrl` | Useful package links for review and enrichment. |
| `updatedAt`, `fetchedAt` | Source update time when available and Actor fetch time. |
| `status`, `source`, `errorMessage` | Row status and whether it came from search or direct package mode. |

### Input configuration

| Setting | JSON key | Use it for | Example |
| --- | --- | --- | --- |
| Search query | `query` | Discover packages by keyword. | `react` |
| Package names | `packageNames` | Fetch known packages directly. | `["react", "@types/node"]` |
| Maximum package rows | `maxItems` | Cap saved rows and control spend. | `50` |
| Include download counts | `includeDownloads` | Enrich each package with npm downloads API counts. | `true` |
| Download period | `downloadPeriod` | Choose `last-day`, `last-week`, or `last-month`. | `last-month` |
| Include maintainers | `includeMaintainers` | Include public maintainer usernames. | `true` |
| Deduplicate package names | `dedupe` | Avoid duplicates across direct and search inputs. | `true` |

### Example input

```json
{
  "query": "react",
  "maxItems": 10,
  "includeDownloads": true,
  "downloadPeriod": "last-month",
  "includeMaintainers": true,
  "dedupe": true
}
````

### Example output

```json
{
  "packageName": "react",
  "scope": null,
  "version": "19.1.0",
  "description": "React is a JavaScript library for building user interfaces.",
  "keywords": ["react"],
  "license": null,
  "publisherUsername": "fb",
  "maintainerUsernames": ["fb", "react-bot"],
  "weeklyDownloads": 143867154,
  "monthlyDownloads": 617430030,
  "downloadsLastMonth": 617430030,
  "dependents": 213476,
  "scoreFinal": 0.95,
  "repositoryUrl": "https://github.com/facebook/react",
  "npmUrl": "https://www.npmjs.com/package/react",
  "status": "ok",
  "source": "search"
}
```

### Pricing

| Tier | Package result price |
| --- | --- |
| Free | `$0.00014087` per successful package row |
| Bronze | `$0.0001225` per successful package row |
| Silver | `$0.000095547` per successful package row |
| Gold | `$0.000073498` per successful package row |
| Platinum | `$0.000048998` per successful package row |
| Diamond | `$0.000034299` per successful package row |

A run start event is `$0.005` per run. Package result pricing is charged for successful npm package metadata rows saved to the dataset.

### Tips for best results

- **Start small**: Use `maxItems: 10` until you confirm the fields match your workflow.
- **Use focused keywords**: Specific terms such as `eslint plugin` produce more useful shortlists than broad words like `plugin`.
- **Mix modes carefully**: Direct `packageNames` are processed first, then search fills the remaining `maxItems`.
- **Expect nullable fields**: Some npm responses omit license, links, dependents, or score fields.

### API usage

Node.js:

```js
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor("fetch_cat/npm-packages-search-scraper").call({
  query: "react",
  maxItems: 10,
  includeDownloads: true
});
console.log(run.defaultDatasetId);
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("fetch_cat/npm-packages-search-scraper").call(run_input={
    "query": "react",
    "maxItems": 10,
    "includeDownloads": True,
})
print(run["defaultDatasetId"])
```

cURL:

```bash
curl -X POST "https://api.apify.com/v2/acts/fetch_cat~npm-packages-search-scraper/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"react","maxItems":10,"includeDownloads":true}'
```

### MCP and AI agents

Use this Actor from MCP-compatible tools through the official Apify MCP Server.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=fetch_cat/npm-packages-search-scraper"
```

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=fetch_cat/npm-packages-search-scraper"
    }
  }
}
```

Example prompt: "Run npm Packages Search Scraper for `eslint plugin` with 25 results and summarize high-popularity packages with repository links."

### Limits and caveats

- **Public npm only**: The Actor does not access private packages, account data, or tokens.
- **No tarball analysis**: It does not download package tarballs or inspect source files.
- **Freshness**: npm registry and download-count data can change after a run finishes.
- **Rate limits**: Public APIs may throttle large or frequent runs; retry logic is bounded.

### Legality and responsible use

Process only data that you are allowed to access. Follow npm's terms, Apify's terms, and applicable laws.

### Related actors

- [Website Contact Finder](https://apify.com/fetch_cat/website-contact-finder)
- [Bing Search Results Scraper](https://apify.com/fetch_cat/bing-search-results-scraper)

### FAQ

#### Can I export results?

Yes. Apify datasets support JSON, CSV, Excel, XML, RSS, and API access.

#### Why are some fields empty?

Some packages do not expose every field publicly. The Actor leaves unavailable fields empty instead of guessing.

#### Does it support scoped packages?

Yes. Direct package inputs can include scoped names such as `@types/node`.

### Support

Open an issue from the Actor page if a run fails or output looks wrong. Include the run ID or run URL, input JSON, expected output, actual output, and a reproducible public URL such as `https://www.npmjs.com/package/react` or the exact npm query.

# Actor input Schema

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

Keyword query for npm package search. Leave empty when using only package names.

## `packageNames` (type: `array`):

Known npm package names to fetch directly, including scoped names such as @types/node.

## `maxItems` (type: `integer`):

Maximum number of dataset rows to save across direct packages and search results.

## `includeDownloads` (type: `boolean`):

Fetch npm downloads API counts for each successful package row.

## `downloadPeriod` (type: `string`):

Window to request from the npm downloads API.

## `includeMaintainers` (type: `boolean`):

Include public npm maintainer usernames when the registry response exposes them.

## `dedupe` (type: `boolean`):

Avoid saving the same package more than once when direct inputs overlap with search results.

## Actor input object example

```json
{
  "query": "react",
  "packageNames": [
    "react",
    "vite",
    "typescript"
  ],
  "maxItems": 10,
  "includeDownloads": true,
  "downloadPeriod": "last-month",
  "includeMaintainers": true,
  "dedupe": true
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# 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",
    "packageNames": [
        "react",
        "vite",
        "typescript"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/npm-packages-search-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",
    "packageNames": [
        "react",
        "vite",
        "typescript",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/npm-packages-search-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",
  "packageNames": [
    "react",
    "vite",
    "typescript"
  ]
}' |
apify call fetch_cat/npm-packages-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "npm Packages Search Scraper",
        "description": "Search npm packages and export registry metadata, popularity scores, maintainers, repository links, and download counts.",
        "version": "0.2",
        "x-build-id": "xoygsxox2X3xjZvtv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/fetch_cat~npm-packages-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-fetch_cat-npm-packages-search-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/fetch_cat~npm-packages-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-fetch_cat-npm-packages-search-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/fetch_cat~npm-packages-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-fetch_cat-npm-packages-search-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": {
                    "query": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Keyword query for npm package search. Leave empty when using only package names."
                    },
                    "packageNames": {
                        "title": "Package names",
                        "type": "array",
                        "description": "Known npm package names to fetch directly, including scoped names such as @types/node.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Maximum package rows",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of dataset rows to save across direct packages and search results.",
                        "default": 10
                    },
                    "includeDownloads": {
                        "title": "Include download counts",
                        "type": "boolean",
                        "description": "Fetch npm downloads API counts for each successful package row.",
                        "default": true
                    },
                    "downloadPeriod": {
                        "title": "Download period",
                        "enum": [
                            "last-day",
                            "last-week",
                            "last-month"
                        ],
                        "type": "string",
                        "description": "Window to request from the npm downloads API.",
                        "default": "last-month"
                    },
                    "includeMaintainers": {
                        "title": "Include maintainer usernames",
                        "type": "boolean",
                        "description": "Include public npm maintainer usernames when the registry response exposes them.",
                        "default": true
                    },
                    "dedupe": {
                        "title": "Deduplicate package names",
                        "type": "boolean",
                        "description": "Avoid saving the same package more than once when direct inputs overlap with search results.",
                        "default": true
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
