# Package Registry Scraper (npm + PyPI) (`dami_studio/package-registry-scraper`) Actor

Scrape package metadata from the npm and PyPI public registries. Search npm by keyword, or look up exact packages on either registry. Get name, version, author, license, repo, keywords and (npm) monthly downloads. No key, no anti-bot.

- **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**: No ratings yet

## 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 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.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

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

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Package Registry Scraper (npm + PyPI)",
        "description": "Scrape package metadata from the npm and PyPI public registries. Search npm by keyword, or look up exact packages on either registry. Get name, version, author, license, repo, keywords and (npm) monthly downloads. No key, no anti-bot.",
        "version": "0.1",
        "x-build-id": "hdbpBDKTnfRS43HqK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/dami_studio~package-registry-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-dami_studio-package-registry-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/dami_studio~package-registry-scraper/runs": {
            "post": {
                "operationId": "runs-sync-dami_studio-package-registry-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/dami_studio~package-registry-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-dami_studio-package-registry-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": {
                    "registry": {
                        "title": "Registry",
                        "enum": [
                            "npm",
                            "pypi"
                        ],
                        "type": "string",
                        "description": "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).",
                        "default": "npm"
                    },
                    "searchQuery": {
                        "title": "Search query (npm only)",
                        "type": "string",
                        "description": "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": {
                        "title": "Package names (exact)",
                        "type": "array",
                        "description": "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.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeDownloads": {
                        "title": "Include monthly downloads (npm)",
                        "type": "boolean",
                        "description": "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).",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max packages (npm search)",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of packages to return from an npm search query. Only applies to npm search; ignored for exact-name lookups.",
                        "default": 50
                    },
                    "notionConnector": {
                        "title": "Notion connector (optional)",
                        "type": "string",
                        "description": "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": {
                        "title": "Notion target data source ID",
                        "type": "string",
                        "description": "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": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "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.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
