# PyPI Scraper: Packages, Releases, Vulnerabilities & Downloads (`winterlock/pypi-package-scraper`) Actor

Export PyPI package metadata, full release history with yanked releases flagged, known security vulnerabilities and daily download counts. Official PyPI JSON API, no login.

- **URL**: https://apify.com/winterlock/pypi-package-scraper.md
- **Developed by:** [Alex Burton](https://apify.com/winterlock) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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.

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

## PyPI Scraper: Packages, Releases, Vulnerabilities & Downloads

Export Python package data from PyPI to JSON, CSV or Excel. Everything comes from PyPI's official JSON API, so there is no HTML parsing and no login.

One Actor, four jobs:

| Mode | What you get |
|---|---|
| **Package details** | Version, summary, licence, author, repository, classifiers, supported Python versions, declared dependencies, development status, release count and download totals |
| **Release history** | Every version with its upload date, file count, total size, wheel and sdist availability, pre-release flag and **yanked status with the maintainer's reason** |
| **Vulnerabilities** | Known advisories for a package or a specific version, with aliases, affected details and the versions that fix them |
| **Daily downloads** | One row per day of download counts |

### Why use this one

- **Yanked releases are flagged.** PyPI lets maintainers withdraw a broken release without deleting it. Pip hides them, so they are invisible in most tooling, yet they are exactly what you want to find when auditing a lockfile. Every release here carries `isYanked` and `yankedReason`.
- **Vulnerabilities per version.** Point it at the exact version you have pinned and get the advisories that apply to it, including which releases fix them.
- **Classifiers turned into usable fields.** Supported Python versions, licence and development status are parsed out of PyPI's classifier strings into their own columns, instead of leaving you a list of 30 colon-separated strings.
- **Built for bulk auditing.** Paste a whole `requirements.txt` worth of names and get one row per package.

### How to use it

1. Choose **What to scrape**.
2. Add **Packages** by project name or pypi.org link.
3. Click **Start**, then download the results or pull them through the Apify API.

#### Example input: audit a requirements file

```json
{
  "mode": "packageDetails",
  "packages": ["requests", "django", "numpy", "pillow"],
  "includeDownloads": true
}
```

#### Example input: find yanked and pre-release versions

```json
{
  "mode": "releases",
  "packages": ["requests"],
  "maxReleasesPerPackage": 200
}
```

#### Example input: check a pinned version for advisories

```json
{
  "mode": "vulnerabilities",
  "packages": ["requests"],
  "version": "2.31.0"
}
```

### Output

Each item carries a `type` field: `package`, `release`, `vulnerability` or `downloads`.

**Package**

```json
{
  "type": "package",
  "registry": "pypi",
  "name": "requests",
  "version": "2.32.3",
  "summary": "Python HTTP for Humans.",
  "license": "Apache-2.0",
  "author": "Kenneth Reitz",
  "maintainer": "Ian Stapleton Cordasco, Nate Prewitt",
  "repositoryUrl": "https://github.com/psf/requests",
  "documentationUrl": "https://requests.readthedocs.io",
  "pythonVersions": ["3", "3.8", "3.9", "3.10", "3.11", "3.12"],
  "developmentStatus": "Production/Stable",
  "requiresPython": ">=3.8",
  "dependencyCount": 8,
  "releaseCount": 152,
  "vulnerabilityCount": 0,
  "isYanked": false,
  "downloadsLastMonth": 1202777296,
  "url": "https://pypi.org/project/requests/"
}
```

**Release**

```json
{
  "type": "release",
  "name": "requests",
  "version": "2.31.0",
  "uploadedAt": "2023-05-22T15:12:42Z",
  "fileCount": 2,
  "totalSizeBytes": 171000,
  "hasWheel": true,
  "hasSdist": true,
  "isPrerelease": false,
  "isYanked": false,
  "url": "https://pypi.org/project/requests/2.31.0/"
}
```

### Pricing

Pay only for results:

| Result | Price |
|---|---|
| Package | $5.00 per 1,000 |
| Release, vulnerability or download day | $1.00 per 1,000 |

Set a maximum spend per run in the run options and the Actor stops cleanly when it is reached.

### Limits to know about

- **There is no search mode, on purpose.** PyPI retired its search API and has not replaced it. Scraping the website search page would break constantly, so this Actor does not pretend to offer it. Give it project names instead.
- **Download counts come from pypistats.org**, not from PyPI. PyPI publishes its download data only through Google BigQuery, and pypistats.org is the standard free republisher of it. If that service is slow or down, download fields come back empty and the rest of the run is unaffected. New or very small projects often have no series at all.
- **Download counts are per project, not per version**, and they count installs by machines including CI, not people.
- **Vulnerability data comes from the Open Source Vulnerability database** via PyPI. Absence of advisories is not proof a package is safe.
- **Author and maintainer are names only by default.** PyPI often stores them as `Name <address>` in the email fields; the Actor keeps the name and drops the address. Turn on *Include author and maintainer emails* to get `authorEmails` and `maintainerEmails` as well, if you have a lawful reason to process them.
- **Vulnerability rows say which release was checked** in `version` (the latest release unless you pin one), and list CVE numbers separately in `cveIds`.
- **One row per vulnerability, not per database entry.** PyPI lists most advisories twice, once from GitHub (GHSA) and once from the Python advisory database (PYSEC). The Actor merges the copies, so you see and pay for each vulnerability once; the other IDs are kept in `aliases`. `vulnerabilityCount` counts these merged, unwithdrawn advisories.

### FAQ

**Do I need a PyPI account?** No. Everything here is public.

**Can I check a whole lockfile?** Yes. Paste every project name into *Packages*. Version pins are not read from the names, so use Vulnerabilities mode with the *Version* field for a specific pin.

**Why is `releaseCount` empty?** The project returned no release map, which normally means the name was wrong or the project was removed.

**Can I run this on a schedule?** Yes. Create a schedule in Apify Console and connect the dataset to Slack, Google Sheets, Zapier or Make to get alerted when a new advisory appears.

### Feedback

Found a bug or need a field that is missing? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

## `mode` (type: `string`):

Package metadata, every release, known security vulnerabilities, or a daily download series.

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

Project names (requests, scikit-learn) or pypi.org links.

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

Adds last day, week and month totals from pypistats.org. One extra request per package.

## `includeContactEmails` (type: `boolean`):

For Package details. Off by default: author and maintainer names are always included, but their email addresses are personal data. Turn on only if you have a lawful reason to process them.

## `maxReleasesPerPackage` (type: `integer`):

For Releases. How many releases to return per package. A package's whole history comes in one request, so this only caps the rows saved.

## `newestReleasesFirst` (type: `boolean`):

For Releases. On, the newest releases come first and the cap keeps the most recent ones. Off, the history starts from the first release.

## `includeEmptyReleases` (type: `boolean`):

PyPI keeps version numbers whose files were all deleted. They are skipped by default.

## `version` (type: `string`):

Check one specific version, for example 2.31.0. Leave empty to check the latest release.

## `includeWithdrawnVulnerabilities` (type: `boolean`):

Advisories later retracted by their reporter are excluded by default.

## `includeMirrorDownloads` (type: `boolean`):

Mirror traffic inflates totals and is excluded by default.

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

Stop the run after saving this many items. Leave empty for no limit.

## `maxConcurrency` (type: `integer`):

How many requests run at once. PyPI's JSON API copes well with four.

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

Not needed for most runs. Consider it only for very large batches.

## Actor input object example

```json
{
  "mode": "packageDetails",
  "packages": [
    "requests"
  ],
  "includeDownloads": true,
  "includeContactEmails": false,
  "maxReleasesPerPackage": 100,
  "newestReleasesFirst": true,
  "includeEmptyReleases": false,
  "includeWithdrawnVulnerabilities": false,
  "includeMirrorDownloads": false,
  "maxConcurrency": 4,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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": [
        "requests"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("winterlock/pypi-package-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": ["requests"] }

# Run the Actor and wait for it to finish
run = client.actor("winterlock/pypi-package-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": [
    "requests"
  ]
}' |
apify call winterlock/pypi-package-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winterlock/pypi-package-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/iAwivOuhgteNgUhoX/builds/6JtHPY8NJzndJNIxD/openapi.json
