# npm Package Stats Scraper (`rainminer/npm-package-stats-scraper`) Actor

Look up npm packages and get the numbers people actually ask for: latest version, license, dependency count, repository, and weekly and monthly downloads. Paste package names or a search query. No API key, no login.

- **URL**: https://apify.com/rainminer/npm-package-stats-scraper.md
- **Developed by:** [rainminer](https://apify.com/rainminer) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.49 / 1,000 packages

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## npm Package Stats Scraper

Get the numbers behind an npm package: **latest version, license, dependency count, repository and download counts**. Paste package names, or search the registry by keyword and let it find them.

No API key and no login. It reads the public npm registry and the public npm downloads API.

### What can this npm scraper do?

- Look up one package or a few hundred in a single run.
- Accept bare names (`react`), scoped names (`@tanstack/react-query`), or npmjs.com package URLs.
- Add weekly and monthly download counts per package.
- Discover packages by keyword with `searchQuery`.
- Flag deprecated packages and keep the deprecation message.
- Optionally read the first publish date and the date of the latest publish.
- Export JSON, CSV or Excel, and schedule a repeat through Apify.

### What data can you extract?

| Field | Meaning |
| --- | --- |
| name | Package name |
| version | Latest published version |
| description | Package description |
| license | License string from the manifest |
| keywords | Manifest keywords |
| homepage | Homepage URL |
| repositoryUrl | Repository URL, normalized to https |
| dependencyCount | Number of runtime dependencies |
| devDependencyCount | Number of dev dependencies |
| unpackedSizeBytes | Published package size |
| fileCount | Files in the published tarball |
| weeklyDownloads | Downloads in the last week |
| monthlyDownloads | Downloads in the last month |
| firstPublishedAt | First publish date, when `includeRegistryDates` is on |
| lastPublishedAt | Latest publish date, when `includeRegistryDates` is on |
| isDeprecated | True when the package is marked deprecated |
| deprecationMessage | Message the maintainer attached to the deprecation |
| packageUrl | npmjs.com page for the package |
| scrapedAt | When this row was collected |

Fields that a package does not publish are `null`, not guessed.

### How to use it

1. Put package names in **Packages**, one per line. The default input is `react` and `vite`.
2. Or leave **Packages** empty and set **Search query**, for example `web scraping`.
3. Keep **Include download counts** on unless you only need metadata: it costs two extra requests per package.
4. Run it and download the dataset. The run summary lands in the key-value store record `SUMMARY`.

`maxItems` caps the whole run, not each package, so a test run stays small.

### Cost

The Actor fetches one registry document per package, plus two download requests when downloads are enabled. It uses the public npm endpoints, so there is no proxy and no API key.

### Notes

- `includeRegistryDates` is off by default because the full registry document is large for very popular packages.
- A package that does not exist is reported in the run summary under `notFound` instead of failing the run.

# Actor input Schema

## `packages` (type: `array`):

npm package names, for example react, @tanstack/react-query, or full npmjs.com package URLs.

## `searchQuery` (type: `string`):

Optional. Discover packages by keyword instead of listing names, for example web scraping or date parser.

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

Maximum number of dataset rows for the whole run.

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

Fetch weekly and monthly downloads from the npm downloads API. Two extra requests per package.

## `includeRegistryDates` (type: `boolean`):

Fetch the full registry document to read the first publish date and the latest publish date. Heavy for very popular packages, so it is off by default.

## Actor input object example

```json
{
  "packages": [
    "react",
    "vite"
  ],
  "maxItems": 50,
  "includeDownloads": true,
  "includeRegistryDates": false
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "packages": [
        "react",
        "vite"
    ]
};

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

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

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

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

```

## CLI example

```bash
echo '{
  "packages": [
    "react",
    "vite"
  ]
}' |
apify call rainminer/npm-package-stats-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rainminer/npm-package-stats-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WJaQSVrbQ1rSSyGs5/builds/SWTdd8VV1qSpK99rs/openapi.json
