# Crates.io Rust Package Scraper - Metadata & Downloads (`ahmdshrif/crates-io-package-scraper`) Actor

Fetches crate metadata (versions, downloads, license, repository, keywords, categories) directly from the official crates.io JSON API for a list of crate URLs.

- **URL**: https://apify.com/ahmdshrif/crates-io-package-scraper.md
- **Developed by:** [Ahmed](https://apify.com/ahmdshrif) (community)
- **Categories:** Developer tools
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$0.30 / 1,000 crate fetcheds

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?

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

## Crates.io Rust Package Scraper

Fetches crate metadata — downloads, versions, license, repository, keywords, MSRV, edition, and more — directly from the official crates.io JSON API for a list of crate URLs. Built for Rust developers, dependency auditors, and package researchers who need structured data on crates.io packages without parsing HTML or hand-rolling API calls.

### Why this scraper

- Reads the official crates.io JSON API instead of rendered HTML, so fields like `rustVersion`, `edition`, `crateSize`, and `publishedBy` come back reliably on every run.
- Returns more fields per crate than typical crates.io scrapers, including MSRV and edition, useful for compatibility audits and dependency vetting.
- Priced at $0.0003 per crate, which is lower than comparable per-record or per-search pricing on similar scrapers.

### Output fields

| Field | Type | Description |
|---|---|---|
| crateName | string | Crate identifier, e.g. serde |
| description | string | Short description of the crate |
| downloads | integer | All-time total download count |
| recentDownloads | integer | Downloads in the recent tracking window |
| maxVersion | string | Highest published version number |
| newestVersion | string | Most recently published version number |
| maxStableVersion | string | Highest stable (non-prerelease) version |
| numVersions | integer | Total number of published versions |
| license | string | SPDX license expression of the latest version |
| repository | string | Source repository URL |
| homepage | string | Project homepage URL |
| documentation | string | Documentation URL, usually docs.rs |
| categories | string | Comma-separated crates.io category slugs |
| keywords | string | Comma-separated crate keywords |
| createdAt | string | ISO timestamp the crate was first published |
| updatedAt | string | ISO timestamp of the latest version update |
| yanked | boolean | Whether the latest version is yanked |
| rustVersion | string | Minimum supported Rust version (MSRV) |
| edition | string | Rust edition used by the latest version |
| crateSize | integer | Size in bytes of the latest published crate file |
| publishedBy | string | GitHub login of the user who published the latest version |

### Input

```json
{
  "startUrls": [
    { "url": "https://crates.io/api/v1/crates/serde" }
  ],
  "maxItems": 50
}
```

### Output

```json
{
  "crateName": "serde",
  "description": "A generic serialization/deserialization framework",
  "downloads": 1326717635,
  "recentDownloads": 283915307,
  "maxVersion": "1.0.229",
  "newestVersion": "1.0.229",
  "maxStableVersion": "1.0.229",
  "numVersions": 316,
  "license": "MIT OR Apache-2.0",
  "repository": "https://github.com/serde-rs/serde",
  "homepage": "https://serde.rs",
  "documentation": "https://docs.rs/serde",
  "categories": "no-std,encoding,no-std::no-alloc",
  "keywords": "no_std,serde,serialization",
  "createdAt": "2014-12-05T20:20:39.487502Z",
  "updatedAt": "2026-07-18T23:05:13.266456Z",
  "yanked": false,
  "rustVersion": "1.56",
  "edition": "2021",
  "crateSize": 83669,
  "publishedBy": "dtolnay"
}
```

### Pricing

Pay-per-event: $0.0003 per crate successfully fetched. A run over 500 crates costs about $0.15; a run over 5,000 crates costs about $1.50.

### Use cases

- Auditing MSRV and edition compatibility across all dependencies in a Cargo.lock before upgrading a project.
- Tracking download and version history for a watchlist of crates as part of a supply-chain or dependency-risk review.
- Building a searchable internal catalog of crate licenses and repository links for open-source compliance checks.

# Actor input Schema

## `startUrls` (type: `array`):

Pages to export.

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

Stop after this many records.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://crates.io/api/v1/crates/serde"
    },
    {
      "url": "https://crates.io/api/v1/crates/tokio"
    },
    {
      "url": "https://crates.io/api/v1/crates/clap"
    }
  ],
  "maxItems": 50
}
```

# Actor output Schema

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

One structured record per input URL.

# 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 = {
    "startUrls": [
        {
            "url": "https://crates.io/api/v1/crates/serde"
        },
        {
            "url": "https://crates.io/api/v1/crates/tokio"
        },
        {
            "url": "https://crates.io/api/v1/crates/clap"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ahmdshrif/crates-io-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 = { "startUrls": [
        { "url": "https://crates.io/api/v1/crates/serde" },
        { "url": "https://crates.io/api/v1/crates/tokio" },
        { "url": "https://crates.io/api/v1/crates/clap" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ahmdshrif/crates-io-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 '{
  "startUrls": [
    {
      "url": "https://crates.io/api/v1/crates/serde"
    },
    {
      "url": "https://crates.io/api/v1/crates/tokio"
    },
    {
      "url": "https://crates.io/api/v1/crates/clap"
    }
  ]
}' |
apify call ahmdshrif/crates-io-package-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ahmdshrif/crates-io-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/pQi2MUVLTln5zgZb3/builds/mITAXBsaKuqqXWpY7/openapi.json
