# Rust-Crates-Scraper (`sage_gate/rust-crates-scraper`) Actor

Scrape Rust crates from crates.io. Get download stats, dependencies, health scores, and package metadata for supply chain analysis.

- **URL**: https://apify.com/sage\_gate/rust-crates-scraper.md
- **Developed by:** [Julia P.](https://apify.com/sage_gate) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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

## Crates.io Scraper - Rust Package Registry Data

Extract metadata, download statistics, dependencies, and health scores from [crates.io](https://crates.io), the official Rust package registry.

### What is this?

This actor scrapes the crates.io API to retrieve detailed information about Rust crates (packages/libraries). Use it to discover Rust libraries, analyze dependencies, assess package health, or monitor the Rust ecosystem.

### Who is this for?

- **Security teams** — Audit Rust dependencies for supply chain risk assessment
- **DevOps engineers** — Monitor dependencies for maintenance status and updates
- **Software architects** — Evaluate libraries before adding them to projects
- **VC analysts & researchers** — Track trends in the Rust ecosystem
- **Recruiters** — Find active Rust developers through package ownership
- **Developers** — Discover well-maintained libraries for your next project

### Features

- 🔍 **Search by keyword** — Find crates matching terms like "web framework" or "database"
- 📦 **Lookup specific packages** — Get data for known crate names
- 📊 **Health scoring** — Customizable scoring based on downloads, maintenance, and trust signals
- 🔗 **Dependency analysis** — See what each crate depends on
- ↩️ **Reverse dependencies** — See which crates depend on each package
- 📜 **Version history** — Get all published versions with release dates
- 🎛️ **Flexible filters** — Filter by license, update recency, minimum downloads

### Input Parameters

#### Search Mode (provide one)

| Parameter | Type | Description |
|-----------|------|-------------|
| `packageNames` | array | List of specific crate names to fetch |
| `keyword` | string | Search term to find matching crates |

#### Filters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `maxResults` | integer | 50 | Maximum crates to return (1-500) |
| `minDownloads` | integer | 0 | Minimum total downloads required |
| `licenseFilter` | string | any | Filter by license: `any`, `mit_apache`, `no_gpl` |
| `updatedWithin` | string | any | Recency filter: `any`, `6months`, `1year` |
| `sortBy` | string | healthScore | Sort by: `healthScore`, `downloads`, `recentDownloads`, `recentlyUpdated` |

#### Data Enrichment

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `includeDependencies` | boolean | true | Fetch direct dependencies |
| `includeReverseDependencies` | boolean | false | Fetch crates that depend on this one |
| `includeVersionHistory` | boolean | false | Fetch all published versions |

#### Health Score Weights (0-10)

Customize how the health score is calculated based on what matters to you:

| Parameter | Default | What it measures |
|-----------|---------|------------------|
| `downloadsWeight` | 6 | Total adoption/usage |
| `recentActivityWeight` | 4 | Current momentum and trend |
| `maintenanceWeight` | 5 | How recently the crate was updated |
| `reverseDepsWeight` | 5 | Trust signal from other crates |

### Output

Each crate returns:
```json
{
    "name": "serde",
    "description": "A generic serialization/deserialization framework",
    "version": "1.0.193",
    "license": "MIT OR Apache-2.0",
    "totalDownloads": 250000000,
    "recentDownloads": 15000000,
    "createdAt": "2015-03-03T03:17:05Z",
    "updatedAt": "2024-01-15T10:30:00Z",
    "daysSinceUpdate": 5,
    "repository": "https://github.com/serde-rs/serde",
    "homepage": "https://serde.rs",
    "documentation": "https://docs.rs/serde",
    "cratesUrl": "https://crates.io/crates/serde",
    "keywords": ["serde", "serialization"],
    "categories": ["encoding"],
    "yanked": false,
    "healthScore": {
        "score": 89,
        "breakdown": {
            "downloads": {"raw": 100, "weight": 6},
            "recentActivity": {"raw": 60, "weight": 4},
            "maintenance": {"raw": 100, "weight": 5},
            "reverseDependencies": {"raw": 100, "weight": 5}
        }
    },
    "dependencies": {
        "count": 2,
        "direct": [
            {"name": "serde_derive", "requirement": "^1.0", "optional": true, "kind": "normal"}
        ]
    },
    "reverseDependencies": {
        "count": 45000,
        "top_dependents": ["tokio", "reqwest", "actix-web"]
    }
}
````

### Health Score Explained

The health score (0-100) helps you quickly assess crate quality. Each factor is scored 0-100, then combined using your weights.

#### Downloads Score

| Downloads | Score |
|-----------|-------|
| 10M+ | 100 |
| 1M+ | 85 |
| 100K+ | 70 |
| 10K+ | 55 |
| 1K+ | 40 |
| 100+ | 25 |
| <100 | 10 |

#### Maintenance Score

| Last Updated | Score |
|--------------|-------|
| < 30 days | 100 |
| < 90 days | 80 |
| < 6 months | 60 |
| < 1 year | 40 |
| < 2 years | 20 |
| > 2 years | 5 |

#### Recent Activity Score

Based on ratio of recent downloads (90 days) to total downloads. Higher ratio = growing adoption.

#### Reverse Dependencies Score

| Dependents | Score |
|------------|-------|
| 100+ | 100 |
| 50+ | 80 |
| 20+ | 60 |
| 5+ | 40 |
| 1+ | 20 |
| 0 | 0 |

### Example Use Cases

#### Find well-maintained web frameworks

- Keyword: `web framework`
- Updated within: `Last 6 months`
- Maintenance weight: `10`
- Sort by: `Health Score`

#### Audit specific dependencies

- Package names: `serde`, `tokio`, `reqwest`, `hyper`
- Include reverse dependencies: `true`
- Include version history: `true`

#### Discover trending libraries

- Keyword: `async`
- Recent activity weight: `10`
- Sort by: `Recent Downloads`

### Rate Limiting

This actor respects the [crates.io crawler policy](https://crates.io/data-access):

- Maximum 1 request per second
- Proper User-Agent identification

Processing time depends on options enabled:

- Basic search: ~1 second per crate
- With dependencies: ~2 seconds per crate
- With reverse deps: ~3 seconds per crate
- All options: ~4 seconds per crate

### Data Source

All data comes from the official [crates.io API](https://crates.io/data-access). This actor does not scrape HTML — it uses the documented JSON API endpoints.

### Related Keywords

Rust packages, Rust libraries, cargo crates, Rust dependency analysis, supply chain

# Actor input Schema

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

List of specific crate names to scrape (e.g., serde, tokio, reqwest)

## `keyword` (type: `string`):

Search for crates matching this keyword (ignored if Package Names is provided)

## `maxResults` (type: `integer`):

Maximum number of crates to return

## `minDownloads` (type: `integer`):

Only include crates with at least this many total downloads

## `licenseFilter` (type: `string`):

Filter crates by license type

## `updatedWithin` (type: `string`):

Only include crates updated within this time period

## `sortBy` (type: `string`):

How to sort the results

## `includeDependencies` (type: `boolean`):

Fetch direct dependencies for each crate (slower, +1 API call per crate)

## `includeReverseDependencies` (type: `boolean`):

Fetch which crates depend on each result (slower, +1 API call per crate)

## `includeVersionHistory` (type: `boolean`):

Fetch all versions for each crate (slower, +1 API call per crate)

## `downloadsWeight` (type: `integer`):

How much total downloads matter in health score (0 = ignore, 10 = very important)

## `recentActivityWeight` (type: `integer`):

How much recent download trend matters in health score (0 = ignore, 10 = very important)

## `maintenanceWeight` (type: `integer`):

How much recent updates matter in health score (0 = ignore, 10 = very important)

## `reverseDepsWeight` (type: `integer`):

How much trust from other crates matters in health score (0 = ignore, 10 = very important)

## Actor input object example

```json
{
  "packageNames": [
    "serde",
    "tokio",
    "actix-web"
  ],
  "keyword": "web framework",
  "maxResults": 50,
  "minDownloads": 0,
  "licenseFilter": "any",
  "updatedWithin": "any",
  "sortBy": "healthScore",
  "includeDependencies": true,
  "includeReverseDependencies": false,
  "includeVersionHistory": false,
  "downloadsWeight": 6,
  "recentActivityWeight": 4,
  "maintenanceWeight": 5,
  "reverseDepsWeight": 5
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("sage_gate/rust-crates-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("sage_gate/rust-crates-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 '{}' |
apify call sage_gate/rust-crates-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Rust-Crates-Scraper",
        "description": "Scrape Rust crates from crates.io. Get download stats, dependencies, health scores, and package metadata for supply chain analysis.",
        "version": "0.0",
        "x-build-id": "LQG2WkCEoBxdyKEtR"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/sage_gate~rust-crates-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-sage_gate-rust-crates-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/sage_gate~rust-crates-scraper/runs": {
            "post": {
                "operationId": "runs-sync-sage_gate-rust-crates-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/sage_gate~rust-crates-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-sage_gate-rust-crates-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": {
                    "packageNames": {
                        "title": "Package Names",
                        "type": "array",
                        "description": "List of specific crate names to scrape (e.g., serde, tokio, reqwest)",
                        "items": {
                            "type": "string"
                        }
                    },
                    "keyword": {
                        "title": "Keyword Search",
                        "type": "string",
                        "description": "Search for crates matching this keyword (ignored if Package Names is provided)"
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of crates to return",
                        "default": 50
                    },
                    "minDownloads": {
                        "title": "Minimum Downloads",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only include crates with at least this many total downloads",
                        "default": 0
                    },
                    "licenseFilter": {
                        "title": "License Filter",
                        "enum": [
                            "any",
                            "mit_apache",
                            "no_gpl"
                        ],
                        "type": "string",
                        "description": "Filter crates by license type",
                        "default": "any"
                    },
                    "updatedWithin": {
                        "title": "Updated Within",
                        "enum": [
                            "any",
                            "6months",
                            "1year"
                        ],
                        "type": "string",
                        "description": "Only include crates updated within this time period",
                        "default": "any"
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "healthScore",
                            "downloads",
                            "recentDownloads",
                            "recentlyUpdated"
                        ],
                        "type": "string",
                        "description": "How to sort the results",
                        "default": "healthScore"
                    },
                    "includeDependencies": {
                        "title": "Include Dependencies",
                        "type": "boolean",
                        "description": "Fetch direct dependencies for each crate (slower, +1 API call per crate)",
                        "default": true
                    },
                    "includeReverseDependencies": {
                        "title": "Include Reverse Dependencies",
                        "type": "boolean",
                        "description": "Fetch which crates depend on each result (slower, +1 API call per crate)",
                        "default": false
                    },
                    "includeVersionHistory": {
                        "title": "Include Version History",
                        "type": "boolean",
                        "description": "Fetch all versions for each crate (slower, +1 API call per crate)",
                        "default": false
                    },
                    "downloadsWeight": {
                        "title": "Downloads Weight",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How much total downloads matter in health score (0 = ignore, 10 = very important)",
                        "default": 6
                    },
                    "recentActivityWeight": {
                        "title": "Recent Activity Weight",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How much recent download trend matters in health score (0 = ignore, 10 = very important)",
                        "default": 4
                    },
                    "maintenanceWeight": {
                        "title": "Maintenance Weight",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How much recent updates matter in health score (0 = ignore, 10 = very important)",
                        "default": 5
                    },
                    "reverseDepsWeight": {
                        "title": "Reverse Dependencies Weight",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How much trust from other crates matters in health score (0 = ignore, 10 = very important)",
                        "default": 5
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
