# npm & PyPI Package Stats Scraper (Downloads, Versions, Repos) (`negligible_carrageen/npm-pypi-package-stats`) Actor

Search npm or look up npm and PyPI packages via the official registry APIs: weekly and monthly downloads, versions, release dates, license, GitHub repo, maintainers.

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

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 & PyPI Package Stats Scraper (Downloads, Versions, Repos)

Get **download counts, latest version, release dates, license, GitHub repo, maintainers and dependencies** for npm and PyPI packages in one dataset. Search npm with the same query syntax as npmjs.com, or paste exact package names for npm and PyPI.

- Uses the **official npm registry, npm downloads API, PyPI JSON API and pypistats.org**. No login, no API key, no proxies, no browser.
- **npm search** with qualifiers: `keywords:`, `author:`, `maintainer:`, `scope:`, `not:deprecated`.
- Daily, weekly and monthly downloads for both ecosystems.
- Release history: first publish date, number of versions, last release and days since last release.
- Missing packages are reported with `found: false` instead of failing the run.

### What can you use it for?

- **Developer tool market research:** size a niche (for example every package tagged `keywords:web-scraping`) by downloads and dependents.
- **Competitor tracking:** compare your library with alternatives every week. Schedule it and send the results to Google Sheets.
- **Dependency audits:** spot abandoned or deprecated dependencies (`daysSinceLastRelease`, `deprecated`) and license mix.
- **DevRel and sponsorship lead lists:** find popular packages with their GitHub repo and maintainers.
- **Investors and analysts:** follow open-source adoption of a company's SDKs on npm and PyPI.
- **Content and newsletters:** rank the fastest-growing packages in a category.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `npmSearch` | string | | npm search query, e.g. `keywords:react hooks`, `author:sindresorhus`, `scope:aws-sdk` |
| `npmPackages` | string list | \[] | Exact npm names, e.g. `react`, `@nestjs/core` |
| `pypiPackages` | string list | \[] | Exact PyPI names, e.g. `requests`, `fastapi` |
| `includeHistory` | boolean | true | Fetch first publish date and version count for npm |
| `includeDownloads` | boolean | true | Fetch daily, weekly and monthly downloads |
| `maxItems` | integer | 100 | Max packages taken from the npm search (up to 5,000) |

#### Example input: compare frameworks across ecosystems

```json
{
  "npmPackages": ["react", "vue", "svelte", "@angular/core"],
  "pypiPackages": ["django", "flask", "fastapi"]
}
```

#### Example input: map a niche on npm

```json
{ "npmSearch": "keywords:web-scraping not:deprecated", "maxItems": 250 }
```

### Output

| Field | Description |
|---|---|
| `ecosystem` | npm or pypi |
| `name`, `version`, `description` | Package name, latest version and summary |
| `found` | false when the package does not exist |
| `license` | License (SPDX when available) |
| `homepage`, `repository`, `githubRepo` | Links, plus owner/repo for GitHub-hosted code |
| `author`, `authorEmail`, `maintainers` | As published in the package metadata |
| `keywords` | Package keywords |
| `dailyDownloads`, `weeklyDownloads`, `monthlyDownloads` | Download counts |
| `dependents` | Dependent packages (npm search results) |
| `dependenciesCount` | Runtime dependencies of the latest version |
| `versionsCount`, `createdAt`, `lastPublished`, `daysSinceLastRelease` | Release history |
| `requiresPython`, `nodeEngines` | Runtime requirements |
| `deprecated` | npm deprecation message |
| `types` | npm package ships TypeScript types |
| `searchScore` | npm search relevance |
| `url` | npmjs.com or pypi.org page |

#### Example output item

```json
{
  "ecosystem": "pypi",
  "name": "fastapi",
  "found": true,
  "version": "0.162.2",
  "description": "FastAPI framework, high performance, easy to learn, fast to code, ready for production",
  "license": "MIT",
  "repository": "https://github.com/fastapi/fastapi",
  "githubRepo": "fastapi/fastapi",
  "author": "Sebastián Ramírez",
  "dailyDownloads": 12717908,
  "weeklyDownloads": 126820280,
  "monthlyDownloads": 381578963,
  "dependenciesCount": 6,
  "versionsCount": 361,
  "createdAt": "2018-12-08T08:14:13.103167Z",
  "requiresPython": ">=3.10",
  "url": "https://pypi.org/project/fastapi/"
}
```

### FAQ

**Can it search PyPI?** PyPI has no official search API, so PyPI packages are looked up by exact name. npm supports full search.

**Where do PyPI downloads come from?** From pypistats.org, which aggregates the official PyPI BigQuery download data. Requests are spaced out to respect its limits.

**Why is a run with huge npm packages slower?** `includeHistory` downloads the full registry document to count versions. Packages like react have thousands of versions. Turn it off for faster runs.

**Why is `dailyDownloads` empty for npm search results?** Search results already include weekly and monthly downloads from npm, so the actor skips extra calls to the rate-limited downloads API. Daily counts are filled for packages you list by name.

**Do I need an npm or PyPI account?** No. Everything comes from public, documented APIs.

**What about personal data?** Author names and emails are included only as published by maintainers in public package metadata. Use them responsibly and in line with privacy laws such as GDPR.

### Related actors

- [Hugging Face Models, Datasets & Spaces Scraper](https://apify.com/negligible_carrageen/huggingface-hub-scraper)
- [Show HN & Launch HN Startup Launches](https://apify.com/negligible_carrageen/show-hn-launches)
- [Hacker News Who's Hiring Jobs](https://apify.com/negligible_carrageen/hn-hiring-jobs)

# Actor input Schema

## `npmSearch` (type: `string`):

Search npm like npmjs.com. Supports qualifiers: 'keywords:react hooks', 'author:sindresorhus', 'maintainer:xyz', 'scope:aws-sdk', 'not:deprecated'. Leave empty to skip search.

## `npmPackages` (type: `array`):

Exact npm package names, e.g. react, axios, @nestjs/core.

## `pypiPackages` (type: `array`):

Exact PyPI project names, e.g. requests, fastapi, pandas.

## `includeHistory` (type: `boolean`):

Fetch first publish date and version count for npm packages. Slower for packages with thousands of versions.

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

Fetch download counts (npm downloads API, pypistats.org for PyPI).

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

Max packages taken from the npm search query. Explicit package lists are always processed in full. Keep this modest (25-50) for faster runs.

## Actor input object example

```json
{
  "npmSearch": "keywords:web-scraping",
  "npmPackages": [
    "react",
    "vue",
    "svelte"
  ],
  "pypiPackages": [
    "requests",
    "fastapi"
  ],
  "includeHistory": true,
  "includeDownloads": true,
  "maxItems": 25
}
```

# Actor output Schema

## `results` (type: `string`):

One item per npm or PyPI package in the default dataset.

# 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 = {
    "npmSearch": "keywords:web-scraping",
    "npmPackages": [
        "react",
        "vue",
        "svelte"
    ],
    "pypiPackages": [
        "requests",
        "fastapi"
    ],
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("negligible_carrageen/npm-pypi-package-stats").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 = {
    "npmSearch": "keywords:web-scraping",
    "npmPackages": [
        "react",
        "vue",
        "svelte",
    ],
    "pypiPackages": [
        "requests",
        "fastapi",
    ],
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("negligible_carrageen/npm-pypi-package-stats").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 '{
  "npmSearch": "keywords:web-scraping",
  "npmPackages": [
    "react",
    "vue",
    "svelte"
  ],
  "pypiPackages": [
    "requests",
    "fastapi"
  ],
  "maxItems": 25
}' |
apify call negligible_carrageen/npm-pypi-package-stats --silent --output-dataset

```

## MCP server setup

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

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/RfuIln80XZeOvHjL7/builds/WKYIDhildXiY9pReR/openapi.json
