# npm + PyPI Package Scraper — Metadata & Downloads (`dami_studio/package-registry-scraper`) Actor

Pick the right library with data, not vibes. Search npm by keyword or look up exact npm and PyPI packages, and get one normalized record each: version, license, author, repository URL, homepage, keywords and npm monthly download counts. No API key, no anti-bot — dependency audits in minutes.

- **URL**: https://apify.com/dami\_studio/package-registry-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Developer tools, Integrations, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$2.00 / 1,000 package returneds

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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Package Registry Scraper (npm + PyPI)

Pull clean, structured package metadata from the **npm** and **PyPI** public registries. No API key, no login, no anti-bot. Search npm by keyword, or look up exact packages by name on either registry — and get a single normalized shape back for both.

### What you get per package

`registry`, `name`, `version`, `description`, `author`, `homepage`, `repository` (decoded to a browseable https URL), `license`, `keywords`, `monthlyDownloads` (npm), and `url` (the human-facing registry page).

**Nullable fields.** Registries don't always populate every field, so the following can be `null`: `description`, `author`, `homepage`, `repository`, `license` (and `keywords` may be an empty array). `monthlyDownloads` is `null` when `includeDownloads` is off, for PyPI packages (no public download endpoint), or if the npm downloads API call fails for a specific package — in which case a warning is logged so you know why.

### Input

| Field | Notes |
|---|---|
| `registry` | `npm` or `pypi`. Default `npm`. |
| `searchQuery` | Keyword search — **npm only** (PyPI has no clean public search API). |
| `packageNames` | Array of exact names — works for **both** registries (e.g. `["requests","fastapi"]`, or npm scoped `["@types/node"]`). |
| `includeDownloads` | Fetch last-month download counts for npm packages. On by default. npm only. |
| `maxItems` | Cap on npm search results. Default 50. |

You must provide either a `searchQuery` (npm) or one or more `packageNames`.

### Registries

- **npm** — keyword search via the registry search API, package detail via `registry.npmjs.org/{pkg}`, and monthly downloads via `api.npmjs.org`.
- **PyPI** — exact-name lookup via `pypi.org/pypi/{pkg}/json`. PyPI has no clean public search API, so a `searchQuery` with `registry=pypi` returns a single diagnostic row telling you to use `packageNames` instead.

### Output

One dataset row per package, deduped by `registry` + `name`. Packages that can't be found, and empty searches, return a single diagnostic row (`ok:false`) and **are not charged**.

### Pricing

Pay-per-result: you are charged once per successfully returned package row. Diagnostic rows (`ok:false`) — bad input, not-found packages, empty searches, network/registry errors — are **never charged**.

### Proxy

These are public, no-auth registries with no anti-bot, so **no proxy is needed** — leave proxy off (the default). Only enable a proxy if you hit IP-based rate limits on very large runs.

### Troubleshooting

- **Empty/bad-input run** returns a `BAD_INPUT` diagnostic row: provide a `searchQuery` (npm) or one or more `packageNames`.
- **`monthlyDownloads` is null** for some npm packages: the downloads API occasionally rate-limits or has no data for a package; the run logs a warning and continues with `null` for that field.
- **PyPI search** isn't supported (PyPI has no clean public search API); use exact `packageNames` with `registry=pypi`.

### Examples

Search npm:

```json
{ "registry": "npm", "searchQuery": "react state management", "maxItems": 25, "includeDownloads": true }
```

Look up Python packages:

```json
{ "registry": "pypi", "packageNames": ["requests", "fastapi"] }
```

# Actor input Schema

## `registry` (type: `string`):

Which package registry to use. npm supports both keyword search and exact-name lookup; PyPI supports exact-name lookup only (it has no clean public search API).

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

Keywords to search the npm registry for (e.g. "react state management"). npm only — ignored for PyPI. Leave empty if you are looking up exact package names instead.

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

Exact package names to look up directly. Works for BOTH registries. For PyPI this is the only supported mode (e.g. \["requests", "fastapi"]). For npm, scoped names like "@types/node" are supported.

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

Fetch last-month download counts for each npm package via the npm downloads API. npm only — PyPI does not expose a public download-count endpoint. Adds one request per package. Note: monthlyDownloads is null when this is off, for PyPI packages, or if the downloads API call fails for a given package (a warning is logged in that case).

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

Maximum number of packages to return from an npm search query. Only applies to npm search; ignored for exact-name lookups.

## `notionConnector` (type: `string`):

Optional. Write each package as a page into your Notion when the run finishes. Authorize a Notion connector once in Settings → API & Integrations → MCP connectors, then pick it here. Leave empty to skip (default) — results are always saved to the dataset regardless.

## `notionParentId` (type: `string`):

Optional. The Notion data source ID of the database to write into (only used if a Notion connector is set). Leave empty to create the pages privately in your workspace instead.

## `proxyConfiguration` (type: `object`):

Optional proxy for registry requests. The npm and PyPI public registries have no anti-bot, so a proxy is NOT needed — leave it off (the default). Only enable a proxy if you hit IP-based rate limits on very large runs.

## Actor input object example

```json
{
  "registry": "npm",
  "searchQuery": "react state management",
  "packageNames": [],
  "includeDownloads": true,
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Scraped rows are stored in the default dataset (one row per result). Blocked/empty/error runs return a single uncharged diagnostic row instead.

# 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 = {
    "searchQuery": "react state management",
    "packageNames": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/package-registry-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 = {
    "searchQuery": "react state management",
    "packageNames": [],
}

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/package-registry-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 '{
  "searchQuery": "react state management",
  "packageNames": []
}' |
apify call dami_studio/package-registry-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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