# ESPN Sports Stats Scraper (`nanodata/espn-sports-stats-scraper`) Actor

Collect sports data from ESPN: player season statistics for NFL, NBA, MLB, NHL and college leagues, game scores by date, and team lists. Pay per row.

- **URL**: https://apify.com/nanodata/espn-sports-stats-scraper.md
- **Developed by:** [nanodata](https://apify.com/nanodata) (community)
- **Categories:** Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 row delivereds

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

## ESPN Sports Stats Scraper

Collect sports data from ESPN. Get season statistics for players in the NFL, NBA, MLB, NHL, WNBA and US college leagues, ranked by the statistic you pick. Get game scores for any date, or the list of teams in a league. Each row is one athlete, one game or one team. You pay per row delivered.

The data comes from the public JSON services that [espn.com](https://www.espn.com/) itself uses. No account and no API key are needed.

### What you get

Every row has `kind` (`athlete`, `game` or `team`), `league`, `sport`, `id`, `name`, `url` and `scrapedAt`.

**Player statistics (`athlete` rows)**

- `position`, `positionAbbreviation`, `age`, `playerStatus`, `headshot`
- `teamId`, `teamName`, `teamAbbreviation`
- `season` and `seasonType`
- `stats`: a flat map of every statistic ESPN shows for the player, keyed as `category.stat`, for example `passing.passingYards`, `offensive.avgPoints` or `batting.homeRuns`. Values are numbers. Statistics that do not apply to the player (for example pitching numbers for a batter) are left out.
- `statsRanks`: the player's rank in the league for each statistic, same keys, when ESPN shows one

**Games (`game` rows)**

- `date`, `status` (for example `Final`), `statusState` (`pre`, `in` or `post`), `completed`
- `homeTeam` and `awayTeam`: id, name, abbreviation, score, record, winner, logo
- `venue`, `attendance`, `neutralSite`, `broadcasts`, `headline`, `week`, `season`, `seasonType`

**Teams (`team` rows)**

- `teamId`, `teamName`, `teamAbbreviation`, `location`, `color`, `logo`

A value the source does not show is null or left out.

### Typical uses

- Fantasy sports tools and draft boards
- Sports betting research and model training data
- Dashboards with league leaders and standings inputs
- Daily score feeds for apps and newsletters
- Sports journalism and academic data sets

### Pricing

You pay per row delivered, plus a small fee for each run.

| Event | Name | Price |
|---|---|---|
| Run start (charged once, together with the first delivered row) | `actor-start` | $0.001 per run |
| One row, whether athlete, game or team | `result-row` | $0.002 per row ($2.00 per 1,000) |

Both row kinds use the same event, `result-row`. A run that finds nothing is not charged. If you set a maximum cost for the run, the actor stops cleanly once the next row would go over it.

**New to Apify?** Every account gets a $5 free monthly platform credit, enough for a first test run before you pay anything.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | text | `athleteStats` | `athleteStats`, `scoreboard` or `teams` |
| `leagues` | list | `nfl` | League keys, for example `nfl`, `nba`, `mlb`, `nhl`, `wnba`, `college-football`, `mens-college-basketball`. Soccer keys `eng.1`, `esp.1`, `ger.1`, `ita.1`, `fra.1`, `usa.1`, `uefa.champions` work in scoreboard and teams mode. You can also write `sport/league`. |
| `season` | number | current | Player statistics: season year, for example `2025` |
| `seasonType` | text | current | Player statistics: `preseason`, `regular` or `postseason` |
| `sort` | text | league default | Player statistics: the statistic to rank by, as `category.stat`. Add `:asc` for ascending order, for example `passing.passingYards` or `offensive.avgPoints`. |
| `dates` | list | today | Scoreboard: days as `YYYYMMDD` or `YYYY-MM-DD`, or a range such as `20261101-20261107` (up to 60 days) |
| `maxItems` | number | 100 | Maximum rows in total, up to 10,000 |

How the modes work:

- `athleteStats` reads the league statistics list page by page, 50 players per page, in the order of your `sort`. With several leagues, they are read one after the other.
- `scoreboard` reads the games of each date for each league. One request per league and day. A range such as `20261101-20261107` is read day by day, up to 60 days.
- `teams` reads the team list of each league.
- Number fields also accept numbers written as text, for example `"50"`.
- Started with no input, the actor returns a sample of 20 NFL players.

#### Example: top NFL passers

```json
{
  "mode": "athleteStats",
  "leagues": ["nfl"],
  "sort": "passing.passingYards",
  "maxItems": 100
}
```

#### Example: NBA scoring leaders from last season

```json
{
  "mode": "athleteStats",
  "leagues": ["nba"],
  "season": 2026,
  "seasonType": "regular",
  "sort": "offensive.avgPoints",
  "maxItems": 50
}
```

#### Example: one week of NFL and Premier League games

```json
{
  "mode": "scoreboard",
  "leagues": ["nfl", "eng.1"],
  "dates": ["20261101-20261107"]
}
```

### Output sample

```json
{
  "kind": "athlete",
  "league": "nfl",
  "sport": "football",
  "id": "4036378",
  "name": "Jordan Love",
  "url": "https://www.espn.com/nfl/player/_/id/4036378/jordan-love",
  "season": 2026,
  "seasonType": "Regular Season",
  "position": "Quarterback",
  "positionAbbreviation": "QB",
  "teamId": "9",
  "teamName": "Green Bay Packers",
  "teamAbbreviation": "GB",
  "headshot": "https://a.espncdn.com/i/headshots/nfl/players/full/4036378.png",
  "age": 28,
  "playerStatus": "Active",
  "stats": { "general.gamesPlayed": 8, "passing.completions": 192, "passing.passingYards": 2246, "passing.passingTouchdowns": 16 },
  "statsRanks": { "passing.passingYards": 1, "passing.completions": 5 },
  "scrapedAt": "2026-11-07T14:30:00Z"
}
```

### Limitations

- The actor reads what ESPN publishes. Statistics, rosters and scores change during the season, and a row shows the values at `scrapedAt`.
- Player statistics are season totals and averages per league, not game logs.
- `athleteStats` works for NFL, college football, NBA, WNBA, men's college basketball, MLB and NHL. Soccer leagues have scoreboard and teams only.
- The statistics in `stats` depend on the sport. Their names are the ones ESPN uses.
- Right after a season rolls over, a league may list few players until games are played.
- Scoreboard shows the games ESPN lists for a day. College leagues can have many games per day, and ESPN may show only a featured part of them.
- ESPN asks clients to be moderate. The actor waits between requests and stops cleanly if the source keeps refusing or returns errors. Only delivered rows are charged.
- This actor does not give betting or fantasy advice.

### FAQ

**Do I need an ESPN account or key?**
No. The actor reads public data.

**Which statistics can I sort by?**
Any statistic that appears in the `stats` map, written as `category.stat`. Run a small sample first to see the names for your league.

**Why did I get fewer rows than `maxItems`?**
The league list holds fewer players, the dates held fewer games, or the maximum cost you set for the run was reached. The run status message says which.

**Why do some players have no value for a statistic?**
ESPN shows no value for that player, for example a quarterback has no rushing title stat. The key is left out of `stats`.

**Can a run be restarted safely?**
Yes. Progress is saved after every batch. A restarted run continues where it stopped and does not deliver or charge the same rows twice.

**Is this affiliated with ESPN?**
No. This is an independent tool that reads public data. Please keep your use modest and in line with the terms of the source.

### Use with AI agents (MCP)

Connect this actor to any MCP-compatible AI client, such as Claude Desktop, Cursor, VS Code, LangChain or LlamaIndex.

**MCP server URL:**

```
https://mcp.apify.com?tools=nanodata/espn-sports-stats-scraper
```

**Example prompt once connected:**

> "Use `espn-sports-stats-scraper` to get the top 10 NBA scorers this season with games played and points per game. Return results as a table."

### Related Actors

- [Transfermarkt Scraper: Football Players and Market Values](https://apify.com/santamaria-automations/transfermarkt-scraper): Read the public Transfermarkt player lists: the valuable players, the valuable players of a competition or the squad of a club.
- [Kalshi Markets Scraper](https://apify.com/nanodata/kalshi-markets-scraper): Collect Kalshi prediction markets: prices, volume, open interest, rules, close times and category.
- [Polymarket Markets Scraper](https://apify.com/nanodata/polymarket-markets-scraper): Get Polymarket prediction markets with outcome prices, volume, liquidity, bid and ask, dates, tags and event data.

### Support

Found a problem or need a field added? Open an issue on the [Issues tab](https://apify.com/nanodata/espn-sports-stats-scraper/issues). We usually reply within one business day. You can also email contact@nanoscrape.com.

# Actor input Schema

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

athleteStats: season statistics per player, ranked by one statistic. scoreboard: games and scores for the dates you give. teams: the teams of each league. Leave the default for a small sample of NFL player statistics.

## `leagues` (type: `array`):

League keys, for example nfl, nba, mlb, nhl, wnba, college-football, mens-college-basketball. Soccer keys such as eng.1, esp.1, ger.1, ita.1, fra.1, usa.1 and uefa.champions work in scoreboard and teams mode. You can also write sport/league. Default: nfl.

## `season` (type: `integer`):

Season year for player statistics, for example 2025. Empty uses the current season.

## `seasonType` (type: `string`):

Player statistics only. Empty uses the current part of the season.

## `sort` (type: `string`):

Player statistics only. A statistic in the form category.stat, for example passing.passingYards, offensive.avgPoints or batting.homeRuns. Add :asc for ascending order. Empty uses the source's default order for the league.

## `dates` (type: `array`):

Scoreboard only. Days as YYYYMMDD or YYYY-MM-DD, or a range such as 20261101-20261107 (up to 60 days, read day by day). Empty returns the current day.

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

Maximum number of rows in total. Default 100.

## Actor input object example

```json
{
  "mode": "athleteStats",
  "leagues": [
    "nfl"
  ],
  "maxItems": 100
}
```

# Actor output Schema

## `defaultDataset` (type: `string`):

One row per athlete, game or team

# 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 = {
    "leagues": [
        "nfl"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nanodata/espn-sports-stats-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 = { "leagues": ["nfl"] }

# Run the Actor and wait for it to finish
run = client.actor("nanodata/espn-sports-stats-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 '{
  "leagues": [
    "nfl"
  ]
}' |
apify call nanodata/espn-sports-stats-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nanodata/espn-sports-stats-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/kNFjApFFbFGGhoXdI/builds/BACXvXuczCmBcZISu/openapi.json
