# npm & PyPI Package Downloads & Leads Scraper | 2Space (`2space/npm-pypi-packages-scraper`) Actor

Fast npm and PyPI open-source package scraper for DevTools lead generation and market research. Scrapes 30-day download counts, versions, GitHub repos, licenses, and maintainer emails.

- **URL**: https://apify.com/2space/npm-pypi-packages-scraper.md
- **Developed by:** [2Space Group](https://apify.com/2space) (community)
- **Categories:** Developer tools, Lead generation, Business
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 packages scraped

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/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 & PyPI Package Downloads & Leads Scraper | 2Space

> **Built by 2Space Group** · Zero-browser **npm package scraper**, **PyPI package scraper**, **npm download stats API**, and **PyPI maintainer leads** extractor engineered for AI agents, MCP clients, developer marketing, and open-source market intelligence.

[![Apify Actor](https://img.shields.io/badge/Apify-npm--pypi--packages--scraper-00C853?style=flat-square)](https://apify.com/reminiscent_medaka/npm-pypi-packages-scraper)
[![MCP Ready](https://img.shields.io/badge/MCP-Ready-2563EB?style=flat-square)](https://mcp.apify.com)
[![Zero Browser](https://img.shields.io/badge/Runtime-Pure%20HTTP%20%2B%20JSON-7C3AED?style=flat-square)](https://apify.com/reminiscent_medaka/npm-pypi-packages-scraper)

Looking for a fast **npm package scraper** or **PyPI package scraper** that delivers real 30-day adoption metrics and verified maintainer contact details in seconds? This **package downloads scraper** queries the official npm Registry Search API, npm Downloads API, and PyPI JSON API over pure HTTP with zero headless browsers, turning raw registry payloads into flat, structured **npm download stats** and **PyPI maintainer leads** ready for CRMs, spreadsheets, databases, and AI agents.

***

### Why Choose This Scraper?

- **Pure HTTP Speed (Zero Browser Overhead):** Queries `registry.npmjs.org`, `api.npmjs.org`, `pypi.org`, and `pypistats.org` directly—returning results in a few seconds without Puppeteer, Playwright, or proxy overhead.
- **Flat, CRM & Agent-Ready Schema:** Outputs clean root-level scalar fields (`ecosystem`, `packageName`, `version`, `description`, `downloadsLast30Days`, `license`, `homepageUrl`, `repositoryUrl`, `packageUrl`, `keywords`, `maintainerName`, `maintainerEmail`, `publishedAt`, `extractedAt`).
- **Smart Maintainer Lead Extraction:** Automatically skips automated CI/OIDC publisher entries (such as GitHub Actions no-reply addresses) when a human maintainer is listed on npm, and parses RFC-style `Name <email>` strings from PyPI metadata.
- **Scoped npm Package Support:** Properly URL-encodes scoped packages like `@modelcontextprotocol/sdk` and `@playwright/mcp` for both registry metadata and 30-day download counts.
- **Empty `{}` Input Ready:** Works immediately with zero configuration—running `{}` extracts PyPI packages (`fastapi`, `pydantic`) and searches npm for `mcp`, returning real packages in under 10 seconds.
- **No Data, No Charge (Pay-Per-Event):** Uses the single `package-scraped` event (`count: 1`), charged **only after** a validated package record is pushed to the dataset, protected by `maxItems` and `maxCostUsd` spending guards.

***

### Common Use Cases

1. **Developer Tooling Lead Generation:** Discover fast-growing npm and PyPI libraries in your niche (AI SDKs, MCP servers, DevOps CLIs, data frameworks) along with maintainer names, emails, homepages, and GitHub repositories.
2. **Ecosystem & Competitor Benchmarking:** Track 30-day download velocity, release cadence (`publishedAt`), and license distribution across competing JavaScript/TypeScript and Python packages.
3. **Open-Source Due Diligence & Sourcing:** Pull normalized SPDX licenses, latest version tags, and repository URLs for internal catalogs or investor sourcing workflows.
4. **AI Agent & MCP Tooling:** Equip ChatGPT, Claude, or Cursor with live package popularity and maintainer lookup capabilities via the Apify MCP Server.

***

### Input Parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `ecosystems` | `string[]` | `["npm", "pypi"]` | Registries to scrape (`"npm"`, `"pypi"`). |
| `searchQuery` | `string` | `"mcp"` | Keyword query for the npm Registry Search API (and fallback PyPI lookup when `pypiPackages` is empty). |
| `pypiPackages` | `string[]` | `["fastapi", "pydantic"]` | Exact PyPI package names to fetch from the PyPI JSON API. |
| `npmPackages` | `string[]` | `[]` | Optional exact npm package names (including scoped packages like `@modelcontextprotocol/sdk`). |
| `maxItems` | `integer` | `10` | Hard cap on deduplicated packages pushed and billed per run. |
| `maxCostUsd` | `number` | `0.25` | Pre-charge spending safety cap in USD for Pay-Per-Event billing. |

***

### Example JSON Output

Each item stored in the default dataset uses flat root fields:

```json
{
  "ecosystem": "npm",
  "packageName": "@modelcontextprotocol/sdk",
  "version": "1.24.0",
  "description": "Model Context Protocol implementation for TypeScript",
  "downloadsLast30Days": 371591728,
  "license": "MIT",
  "homepageUrl": "https://modelcontextprotocol.io/",
  "repositoryUrl": "https://github.com/modelcontextprotocol/typescript-sdk",
  "packageUrl": "https://www.npmjs.com/package/@modelcontextprotocol/sdk",
  "keywords": ["mcp", "modelcontextprotocol", "ai"],
  "maintainerName": "jspahrsummers",
  "maintainerEmail": "maintainer@example.com",
  "publishedAt": "2026-11-28T14:20:00.000Z",
  "extractedAt": "2026-12-01T08:15:00.000Z"
}
```

A full execution summary is saved to the default Key-Value Store under `RUN_DIAGNOSTICS`, including per-source HTTP status codes, parsed counts, deduplication totals, and cost-limit flags.

***

### MCP & AI Agent Integration (ChatGPT, Claude, Cursor)

Connect `reminiscent_medaka/npm-pypi-packages-scraper` to any MCP-compatible AI assistant or automation platform:

1. **ChatGPT / Claude Desktop / Cursor (Apify MCP Server):**
   Connect directly to the Apify MCP endpoint with this Actor pre-selected:
   ```text
   https://mcp.apify.com/?actors=reminiscent_medaka/npm-pypi-packages-scraper
   ```
   Or add the `mcpServers` block in Cursor or Claude Desktop:
   ```json
   {
     "mcpServers": {
       "apify-npm-pypi-packages": {
         "url": "https://mcp.apify.com/?actors=reminiscent_medaka/npm-pypi-packages-scraper",
         "headers": {
           "Authorization": "Bearer YOUR_APIFY_TOKEN"
         }
       }
     }
   }
   ```
   Then ask your assistant: *"Use npm-pypi-packages-scraper to find the top 10 npm packages matching 'mcp' along with their 30-day downloads and maintainer emails."*

2. **REST API / n8n / Make / Zapier:**
   Call the synchronous dataset endpoint directly from any HTTP client:
   ```text
   POST https://api.apify.com/v2/acts/reminiscent_medaka~npm-pypi-packages-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN
   ```

***

### Pricing & Guarantees

- **Event:** `package-scraped` (`count: 1` per validated pushed package).
- **No Data, No Charge:** If a registry lookup fails or returns zero valid items, `Actor.charge()` is never called.
- **Budget Controls:** Both `maxItems` and `maxCostUsd` are enforced prior to pushing and charging, and Apify's `eventChargeLimitReached` halts the run cleanly when your spending limit is reached.

# Actor input Schema

## `ecosystems` (type: `array`):

Package registries to scrape. Supported values: 'npm', 'pypi'.

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

Keyword query for npm registry search (e.g., 'mcp', 'ai agent', 'langchain'). Also used as a fallback PyPI package lookup when pypiPackages is empty.

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

List of exact PyPI package names to scrape via PyPI JSON API (e.g., 'fastapi', 'pydantic', 'httpx').

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

Optional list of exact npm package names (including scoped packages like '@modelcontextprotocol/sdk') to scrape directly.

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

Hard cap on the maximum number of deduplicated packages to push and charge.

## `maxCostUsd` (type: `number`):

Pre-charge spending safety cap in USD for Pay-Per-Event billing.

## Actor input object example

```json
{
  "ecosystems": [
    "npm",
    "pypi"
  ],
  "searchQuery": "mcp",
  "pypiPackages": [
    "fastapi",
    "pydantic"
  ],
  "npmPackages": [],
  "maxItems": 10,
  "maxCostUsd": 0.25
}
```

# Actor output Schema

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

Dataset items containing extracted npm and PyPI packages with flat scalar fields.

# 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 = {
    "ecosystems": [
        "npm",
        "pypi"
    ],
    "searchQuery": "mcp",
    "pypiPackages": [
        "fastapi",
        "pydantic"
    ],
    "npmPackages": [],
    "maxItems": 10,
    "maxCostUsd": 0.25
};

// Run the Actor and wait for it to finish
const run = await client.actor("2space/npm-pypi-packages-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 = {
    "ecosystems": [
        "npm",
        "pypi",
    ],
    "searchQuery": "mcp",
    "pypiPackages": [
        "fastapi",
        "pydantic",
    ],
    "npmPackages": [],
    "maxItems": 10,
    "maxCostUsd": 0.25,
}

# Run the Actor and wait for it to finish
run = client.actor("2space/npm-pypi-packages-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 '{
  "ecosystems": [
    "npm",
    "pypi"
  ],
  "searchQuery": "mcp",
  "pypiPackages": [
    "fastapi",
    "pydantic"
  ],
  "npmPackages": [],
  "maxItems": 10,
  "maxCostUsd": 0.25
}' |
apify call 2space/npm-pypi-packages-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,2space/npm-pypi-packages-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/IBsGHUs8LrVibmJqa/builds/xfFixI9II7gyENhtA/openapi.json
