# Jsdelivr Cdn Stats Scraper (`zerobreak/jsdelivr-cdn-stats-scraper-202610120341`) Actor

jsDelivr CDN Stats Scraper is a Python tool designed to extract global CDN traffic statistics, package download metrics, version usage trends, and bandwidth analytics from jsDelivr. It exports structured open-source hosting datasets into clean CSV or JSON format

- **URL**: https://apify.com/zerobreak/jsdelivr-cdn-stats-scraper-202610120341.md
- **Developed by:** [ZeroBreak](https://apify.com/zerobreak) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

### jsDelivr CDN Stats Scraper — Package Hits, Bandwidth, and Versions

### Overview

jsDelivr CDN Stats Scraper collects publicly available CDN usage statistics for npm packages and supported GitHub-hosted files. It can retrieve package hit counts, bandwidth statistics, published versions, and rankings of popular packages.

Choose a collection mode, specify package names and a reporting period, and review the results in an Apify dataset. Export the collected data as JSON, CSV, or Excel for reporting and comparisons over time.

### Features

- **Package statistics:** Collect CDN hit counts and bandwidth usage for selected packages.
- **Version discovery:** Retrieve published versions for supported npm packages.
- **Package rankings:** Collect ranked package statistics for supported reporting periods.
- **Multiple package formats:** Work with npm package names and supported GitHub file identifiers in the format `gh/user/repo`.
- **Flexible reporting periods:** Select daily, weekly, monthly, quarterly, or yearly statistics where supported.
- **Structured output:** Keep package names, statistics, rankings, and collection metadata organized in dataset rows.
- **Duplicate reduction:** Avoid duplicate package, version, or ranking records.
- **Dataset exports:** Export results to JSON, CSV, or Excel for further analysis.

### Use Cases

- **Package monitoring:** Track CDN usage for libraries used in your applications.
- **Version research:** Review published package versions for dependency research.
- **Popularity analysis:** Compare package rankings across supported reporting periods.
- **GitHub-hosted files:** Collect usage statistics for supported GitHub-hosted resources.
- **Historical comparisons:** Compare repeated exports to identify changes in package hits and bandwidth.
- **Reporting dashboards:** Prepare structured usage data for spreadsheet analysis and visualization.

### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `mode` | String | `package` | Collection mode: `package`, `versions`, or `top`. |
| `packages` | Array | `["react"]` | npm package names or supported GitHub identifiers in the format `gh/user/repo`. |
| `period` | String | `month` | Reporting period: `day`, `week`, `month`, `quarter`, or `year`. |
| `includeTop` | Boolean | `false` | Whether to also collect the top-package list after the selected mode. |
| `maxItems` | Integer | `100` | Maximum number of successful records to retain. Maximum: `1000`. |

### Example Input

```json id="6d1h3v"
{
  "mode": "package",
  "packages": ["react"],
  "period": "month",
  "includeTop": false,
  "maxItems": 100
}
```

To retrieve package versions, set `mode` to `versions`.

To retrieve ranked package statistics, set `mode` to `top` and choose the required `period`.

To include the top-package list alongside another collection mode, set `includeTop` to `true`.

For supported GitHub-hosted resources, provide an identifier such as `gh/prebid/currency-file`.

### What Data Does This Actor Extract?

The actor produces structured dataset rows based on the selected collection mode. Package-statistics records include hit counts, bandwidth totals, ranking information, and available daily breakdowns. Version records identify individual package versions, while top-package records contain ranking and usage information where available.

#### Extracted Data Fields

| Field | Type | Description |
|---|---|---|
| `packageName` | String | Package name or supported GitHub resource identifier. |
| `registryKind` | String | Resource category, such as `npm` or `gh`. |
| `period` | String | Reporting period used for statistics. |
| `version` | String | Package version, when the record represents a version. |
| `hitsTotal` | Integer | Total CDN hits for the reporting period, when available. |
| `bandwidthTotal` | Integer | Total bandwidth in bytes for the reporting period, when available. |
| `hits` | Object | Hit statistics, potentially including rankings, totals, and daily values. |
| `bandwidth` | Object | Bandwidth statistics, potentially including rankings, totals, and daily values. |
| `links` | Object | Related resource references returned with the record, when available. |
| `mode` | String | Collection category: `package`, `versions`, or `top`. |
| `scraped_at` | String | Timestamp when the record was created, in UTC. |

The fields available in each row depend on the selected mode and the information returned for that package or resource.

### Example Output

A package-statistics record may look like this:

```json id="q3c7mb"
{
  "packageName": "react",
  "registryKind": "npm",
  "period": "month",
  "hitsTotal": 216826611,
  "bandwidthTotal": 1201457489495,
  "hits": {
    "rank": 169,
    "typeRank": 137,
    "total": 216826611
  },
  "bandwidth": {
    "rank": 1158,
    "typeRank": 519,
    "total": 1201457489495
  },
  "mode": "package",
  "scraped_at": "2026-10-12T00:00:00+00:00"
}
```

The figures are illustrative and should not be treated as current jsDelivr statistics.

### Data by Mode

| Mode | Data collected |
|---|---|
| `package` | Package hit counts, bandwidth totals, rankings, and available daily breakdowns. |
| `versions` | Published version information for supported npm packages. |
| `top` | Ranked package statistics, including hit and bandwidth information where available. |

### Working with Your Dataset

1. Run the actor with the required collection mode and package identifiers.
2. Open the resulting dataset.
3. Review the package statistics, version records, or ranking information.
4. Export the results as JSON, CSV, or Excel.
5. Compare exports from different runs to analyze changes in CDN usage.

### Important Notes

- Statistics reflect the information available from jsDelivr when the data is collected.
- Results vary by collection mode and selected reporting period.
- Supported reporting periods are `day`, `week`, `month`, `quarter`, and `year`.
- Package statistics may be returned even when a package has no recorded hits.
- Version availability depends on the selected package and the information returned.
- The `maxItems` setting limits the number of successful records retained.
- Ranking results are limited to the available top-package data; the actor does not provide unlimited ranking pagination.

### FAQ

**What does the package mode collect?**

It collects CDN hit counts, bandwidth statistics, ranking information, and available daily breakdowns for selected packages.

**Can I collect multiple packages in one run?**

Yes. Add multiple package names or supported GitHub identifiers to the `packages` array.

**Can I retrieve package versions instead of usage statistics?**

Yes. Set `mode` to `versions` to collect published version information for supported npm packages.

**Can I compare daily and monthly statistics?**

Yes. Run the actor with different `period` values and compare the resulting datasets.

**Can I collect popular package rankings?**

Yes. Select `top` mode to retrieve the available ranked package statistics.

**Can I export the data to Excel?**

Yes. Export the Apify dataset as Excel or CSV for spreadsheet analysis, or use JSON for structured data processing.

### Disclaimer

This actor is an independent data collection tool and is not affiliated with or endorsed by jsDelivr. The collected statistics depend on the information available at collection time. Package rankings, hit counts, and bandwidth values may change over time.

### Is Web Scraping Legal?

Collecting information that is already public is generally legal. Scraping is not the same thing as hacking, and there is no single law that bans it. The limits are the usual ones: do not break into accounts, do not take private or confidential data, and be careful with personal data and copyrighted works. A site's terms can also restrict how you access it. Facts such as a public name, price, or rating are not the same thing as republishing someone's article or photo.

This actor collects information from public pages. It does not log in and it does not bypass access controls.

For a longer explanation, see Apify's article [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

# Actor input Schema

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

Package hit stats: stats for each package name you list. Package versions: every version of each package. Top packages: the busiest packages on jsDelivr. Search packages: find many packages matching each search word, with their jsDelivr stats.

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

In Package hit stats and Package versions modes, enter exact package names such as react or @angular/core (prefix gh/ for GitHub repos). In Search packages mode, enter search words such as react; each word returns many matching packages.

## `period` (type: `string`):

Time window for hits and bandwidth.

## `includeTop` (type: `boolean`):

Add the top packages list to the results, using any item budget left after the other modes.

## `includeStats` (type: `boolean`):

Search packages mode only. Adds hits, bandwidth and ranks to each result. This costs one extra request per result, so turn it off for faster runs.

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

Maximum number of result rows to save. With several search words, this limit is shared between them.

## `requestDelaySecs` (type: `number`):

Pause between requests, in seconds. Minimum 0.3.

## `timeoutSecs` (type: `integer`):

Stop collecting after this many seconds. Rows saved so far are kept.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for a single request before retrying.

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

Optional proxy settings.

## Actor input object example

```json
{
  "mode": "package",
  "packages": [
    "react"
  ],
  "period": "month",
  "includeTop": false,
  "includeStats": true,
  "maxItems": 100,
  "requestDelaySecs": 0.3,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Package name, registry, period, version, hit and bandwidth totals, rank, and mode.

## `errors` (type: `string`):

Failed requests with the input value, HTTP status, and message.

## `dataset` (type: `string`):

Every row from the run, without a table view applied.

# 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": [
        "react"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zerobreak/jsdelivr-cdn-stats-scraper-202610120341").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": ["react"] }

# Run the Actor and wait for it to finish
run = client.actor("zerobreak/jsdelivr-cdn-stats-scraper-202610120341").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": [
    "react"
  ]
}' |
apify call zerobreak/jsdelivr-cdn-stats-scraper-202610120341 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zerobreak/jsdelivr-cdn-stats-scraper-202610120341"
        }
    }
}
```

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/FMfzzoHk76UgJShCt/builds/5KURLS32fksSnUofl/openapi.json
