# ESPN Scraper (`crawlerbros/espn-scraper`) Actor

Scrape ESPN public API with scoreboards, standings, teams, news, and game details for NFL, NBA, MLB, NHL, MLS, Premier League, La Liga, F1, UFC, PGA Golf, ATP Tennis, and more. No API key required.

- **URL**: https://apify.com/crawlerbros/espn-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 7 total users, 1 monthly users, 65.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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?

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

## ESPN Scraper

Scrape live scores, standings, team info, news, and game details from ESPN's public API — covering NFL, NBA, MLB, NHL, MLS, Premier League, La Liga, Bundesliga, ATP Tennis, PGA Golf, UFC, Formula 1, and more.

**No API key, no login, no proxy required.** Works out-of-the-box on the Apify free plan.

### What you can scrape

| Mode | Description |
|------|-------------|
| **Scoreboard** | Live and recent game scores with teams, venue, broadcast info |
| **Standings** | League/conference rankings with wins, losses, win percentage |
| **Teams** | Full team roster for any league with logos and records |
| **Team Detail** | In-depth info for a single team (venue, colors, links) |
| **News** | Latest headlines with descriptions, images, and author |
| **Game Detail** | Full boxscore context — leaders, recap, venue, broadcast |

### Supported Sports & Leagues

| Sport | League | Slug |
|-------|--------|------|
| Football | NFL | `football` / `nfl` |
| Football | College Football | `football` / `college-football` |
| Basketball | NBA | `basketball` / `nba` |
| Basketball | College Basketball | `basketball` / `mens-college-basketball` |
| Baseball | MLB | `baseball` / `mlb` |
| Hockey | NHL | `hockey` / `nhl` |
| Soccer | MLS | `soccer` / `usa.1` |
| Soccer | Premier League | `soccer` / `eng.1` |
| Soccer | La Liga | `soccer` / `esp.1` |
| Soccer | Bundesliga | `soccer` / `ger.1` |
| Tennis | ATP | `tennis` / `atp` |
| Golf | PGA Tour | `golf` / `pga` |
| MMA | UFC | `mma` / `ufc` |
| Racing | Formula 1 | `racing` / `f1` |

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `mode` | select | Yes | What to fetch: `scoreboard`, `standings`, `teams`, `teamDetail`, `news`, `gameDetail` |
| `sport` | select | No | Sport category (e.g. `basketball`). Auto-corrected based on league. |
| `league` | select | No | League slug (e.g. `nba`). Default: `nba`. |
| `teamId` | string | For `teamDetail` | ESPN numeric team ID (get from `teams` mode output) |
| `eventId` | string | For `gameDetail` | ESPN numeric event ID (get from `scoreboard` mode output) |
| `maxItems` | integer | No | Max records to emit (1–500, default 20) |

#### Example inputs

**NBA Scoreboard (today's games):**

```json
{
  "mode": "scoreboard",
  "sport": "basketball",
  "league": "nba",
  "maxItems": 20
}
```

**NFL Standings:**

```json
{
  "mode": "standings",
  "sport": "football",
  "league": "nfl",
  "maxItems": 50
}
```

**Premier League Teams:**

```json
{
  "mode": "teams",
  "sport": "soccer",
  "league": "eng.1",
  "maxItems": 30
}
```

**NBA Game Detail (requires an eventId from scoreboard):**

```json
{
  "mode": "gameDetail",
  "sport": "basketball",
  "league": "nba",
  "eventId": "401873199"
}
```

### Output

All records include `mode`, `sport`, `league`, and `scrapedAt` fields.

#### Scoreboard record

```json
{
  "mode": "scoreboard",
  "sport": "basketball",
  "league": "nba",
  "eventId": "401873199",
  "name": "Oklahoma City Thunder at San Antonio Spurs",
  "date": "2026-05-23T00:30Z",
  "homeTeam": "San Antonio Spurs",
  "homeScore": "98",
  "awayTeam": "Oklahoma City Thunder",
  "awayScore": "110",
  "status": "Final",
  "venue": "Frost Bank Center, San Antonio, TX",
  "broadcast": "TNT",
  "scrapedAt": "2026-05-23T01:00:00+00:00"
}
```

#### Standings record

```json
{
  "mode": "standings",
  "sport": "basketball",
  "league": "nba",
  "team": "Boston Celtics",
  "teamId": "2",
  "abbreviation": "BOS",
  "conference": "Eastern Conference",
  "wins": "64",
  "losses": "18",
  "winPct": ".780",
  "rank": "1",
  "scrapedAt": "2026-05-23T01:00:00+00:00"
}
```

#### Teams record

```json
{
  "mode": "teams",
  "sport": "basketball",
  "league": "nba",
  "teamId": "2",
  "name": "Boston Celtics",
  "abbreviation": "BOS",
  "location": "Boston",
  "color": "007A33",
  "logoUrl": "https://a.espncdn.com/i/teamlogos/nba/500/bos.png",
  "wins": 64,
  "losses": 18,
  "scrapedAt": "2026-05-23T01:00:00+00:00"
}
```

#### News record

```json
{
  "mode": "news",
  "sport": "basketball",
  "league": "nba",
  "headline": "Celtics clinch Eastern Conference title",
  "description": "Boston defeats Miami in six games.",
  "publishDate": "2026-05-22T23:00:00Z",
  "url": "https://www.espn.com/nba/story/_/id/12345/celtics-clinch",
  "imageUrl": "https://a.espncdn.com/photo/2026/0522/celtics.jpg",
  "author": "Adrian Wojnarowski",
  "category": "NBA",
  "scrapedAt": "2026-05-23T01:00:00+00:00"
}
```

#### Game Detail record

```json
{
  "mode": "gameDetail",
  "sport": "basketball",
  "league": "nba",
  "eventId": "401873199",
  "name": "OKC at SA",
  "date": "2026-05-23T00:30Z",
  "homeTeam": "San Antonio Spurs",
  "homeScore": "98",
  "awayTeam": "Oklahoma City Thunder",
  "awayScore": "110",
  "status": "Final",
  "venue": "Frost Bank Center, San Antonio, TX",
  "broadcast": "TNT, ESPN+",
  "leaders": [
    {
      "team": "Oklahoma City Thunder",
      "category": "Points",
      "athlete": "Shai Gilgeous-Alexander",
      "value": "38"
    }
  ],
  "recap": "Thunder take 3-1 series lead with impressive road win.",
  "scrapedAt": "2026-05-23T01:00:00+00:00"
}
```

### Data Source

Data is sourced from **ESPN's public REST API** (`site.api.espn.com` and `site.web.api.espn.com`). These endpoints are publicly accessible, require no authentication, and return full JSON responses from Apify datacenter IPs.

This actor was built as a replacement for SofascoreScraper which was blocked at the API level from datacenter IPs.

### Tips

- Use `mode=teams` first to get valid `teamId` values for `mode=teamDetail`
- Use `mode=scoreboard` to get valid `eventId` values for `mode=gameDetail`
- The `sport` field is auto-corrected if it doesn't match the selected league
- Scoreboard returns today's scheduled or completed games; off-season will return 0 events
- Standings data may be limited or unavailable during off-season periods

### FAQs

**Q: Does this require an API key?**
A: No. ESPN's public API is freely accessible with no authentication.

**Q: How often is the data updated?**
A: ESPN updates scores in near real-time during games. News and standings reflect the latest available data at scrape time.

**Q: Can I get historical game data?**
A: The scoreboard endpoint shows current or recent games. For historical data, use `mode=gameDetail` with a specific `eventId`.

**Q: Why is the scoreboard empty?**
A: If there are no games today (off-season or no scheduled games), the scoreboard will return 0 records. This is expected behavior.

**Q: How do I find a team's ID?**
A: Run `mode=teams` for the relevant sport/league. The `teamId` field in each result is the ESPN numeric ID.

**Q: Is there a rate limit?**
A: ESPN's public API is generous but the actor includes automatic retry logic with exponential backoff for 429/5xx responses.

# Actor input Schema

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

What data to fetch from ESPN.

## `sport` (type: `string`):

Sport category (must match the league you choose).

## `league` (type: `string`):

League slug. Must be compatible with the selected Sport.

## `teamId` (type: `string`):

ESPN numeric team ID. Required for mode=teamDetail. Find it from mode=teams output (teamId field).

## `eventId` (type: `string`):

ESPN numeric event ID. Required for mode=gameDetail. Find it from mode=scoreboard output (eventId field).

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

Maximum number of records to emit. Applies to scoreboard, teams, news, and standings modes.

## Actor input object example

```json
{
  "mode": "news",
  "sport": "basketball",
  "league": "nba",
  "maxItems": 20
}
```

# Actor output Schema

## `espnData` (type: `string`):

Dataset containing all scraped ESPN records (scores, standings, teams, news, or game details).

# 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 = {
    "mode": "news",
    "sport": "basketball",
    "league": "nba",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/espn-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 = {
    "mode": "news",
    "sport": "basketball",
    "league": "nba",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/espn-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 '{
  "mode": "news",
  "sport": "basketball",
  "league": "nba",
  "maxItems": 20
}' |
apify call crawlerbros/espn-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/espn-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/1wH95EkaDQTw3U3rT/builds/1ifgPP61kcD7WePNu/openapi.json
