# Understat xG Player Stats Scraper (`parseforge/understat-xg-scraper`) Actor

Pull player expected goals data from Understat for the top European leagues. Each player returns games, minutes, goals, assists, shots, xG, xA, non penalty xG, xGChain, and xGBuildup for a chosen season. Great for football analytics, model building, and player scouting.

- **URL**: https://apify.com/parseforge/understat-xg-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Developer tools, AI, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

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

![ParseForge Banner](https://github.com/ParseForge/apify-assets/blob/ad35ccc13ddd068b9d6cba33f323962e39aed5b2/banner.jpg?raw=true)

## ⚽ Understat xG Player Stats Scraper

> 🚀 **Get the full xG leaderboard for a league in one run.** EPL 2024/2025 returns 562 players with goals, expected goals, assists, and expected assists.

> 🕒 **Last updated:** 2026-06-02 · **📊 23 fields** per player · 6 leagues · seasons from 2014

Pull advanced player statistics from Understat, the expected goals data source for top European football. Pick a league and a season, and for every player get games, minutes, goals, assists, shots, xG, xA, non penalty xG, xGChain, and xGBuildup.

**Coverage:** Premier League, La Liga, Bundesliga, Serie A, Ligue 1, and the Russian Premier League, for every season from 2014 to the current campaign.

| 🎯 Target Audience | 💡 Primary Use Cases |
|---|---|
| Football analysts | Build xG models and reports |
| Bettors and traders | Find over and under performers |
| Scouts and clubs | Compare player output |
| Data scientists | Build football datasets |

### 📋 What the Understat xG Player Stats Scraper does

- Pulls the complete player list for a league and season.
- Returns 23 structured fields per player, including xG and xA.
- Includes non penalty xG, xGChain, and xGBuildup advanced metrics.
- Numbers come parsed and ready, with xG values rounded for readability.
- Links each player to their Understat profile.
- Exports to CSV, Excel, JSON, XML, or via API.

### 🎬 Full Demo (_🚧 Coming soon_)

### ⚙️ Input

| Field | Type | Description |
|---|---|---|
| `league` | string | League to scrape (Premier League, La Liga, and more). |
| `season` | integer | Season start year (2024 means 2024/2025). |
| `maxItems` | integer | Cap on players returned. Free plan is limited to 10. |

**Example 1: Premier League**
```json
{
  "league": "EPL",
  "season": 2024,
  "maxItems": 100
}
````

**Example 2: La Liga, an older season**

```json
{
  "league": "La_liga",
  "season": 2021,
  "maxItems": 50
}
```

> ⚠️ **Good to Know:** the season value is the start year of the campaign, so 2024 returns the 2024/2025 season. Players are returned in goals order. Six leagues are supported, with data going back to the 2014/2015 season.

### 📊 Output

Each record contains the following fields:

| Field | Description |
|---|---|
| 🆔 `playerId` | Understat player ID |
| ⚽ `playerName` | Player name |
| 🛡 `team` | Team name |
| 📍 `position` | Position |
| 🏆 `league` | League name |
| 📅 `season` | Season label |
| 🎮 `games` | Games played |
| ⏱ `minutes` | Minutes played |
| 🥅 `goals` | Goals |
| 🅰 `assists` | Assists |
| 🎯 `shots` | Shots |
| 🔑 `keyPasses` | Key passes |
| 📈 `xG` | Expected goals |
| 📈 `xA` | Expected assists |
| 🥅 `npGoals` | Non penalty goals |
| 📊 `npxG` | Non penalty expected goals |
| 🔗 `xGChain` | xG chain involvement |
| 🏗 `xGBuildup` | xG buildup involvement |
| 🟨 `yellowCards` | Yellow cards |
| 🟥 `redCards` | Red cards |
| 🔗 `playerUrl` | Understat profile link |
| 🕒 `scrapedAt` | Collection timestamp |
| ❌ `error` | Error message, null on success |

**Real sample records:**

```json
{
  "playerId": 3423,
  "playerName": "Kylian Mbappe-Lottin",
  "team": "Real Madrid",
  "position": "F",
  "league": "La Liga",
  "season": "2024/2025",
  "games": 34,
  "minutes": 2938,
  "goals": 31,
  "assists": 3,
  "shots": 161,
  "keyPasses": 51,
  "xG": 30.14,
  "xA": 9.39,
  "npGoals": 24,
  "npxG": 23.45,
  "xGChain": 38.31,
  "xGBuildup": 11.08,
  "playerUrl": "https://understat.com/player/3423",
  "error": null
}
```

```json
{
  "playerName": "Robert Lewandowski",
  "team": "Barcelona",
  "league": "La Liga",
  "season": "2024/2025",
  "games": 35,
  "goals": 27,
  "assists": 2,
  "shots": 121,
  "xG": 29.41,
  "xA": 2.48,
  "npxG": 23.1,
  "error": null
}
```

```json
{
  "playerName": "Mohamed Salah",
  "team": "Liverpool",
  "league": "Premier League",
  "season": "2024/2025",
  "games": 38,
  "goals": 29,
  "assists": 18,
  "shots": 130,
  "xG": 27.71,
  "xA": 15.86,
  "npxG": 20.86,
  "error": null
}
```

### ✨ Why choose this Actor

- **Full leaderboard.** Every player in a league and season, not just the top names.
- **Advanced metrics.** xG, xA, npxG, xGChain, and xGBuildup in one row.
- **Ready numbers.** Values are parsed and rounded, not raw strings.
- **Six leagues, many seasons.** Coverage back to 2014.
- **Ready to export.** CSV, Excel, JSON, XML, or API, with a clean table view.

### 📈 How it compares to alternatives

| | Understat xG Player Stats Scraper | Manual copy | Generic web scrapers |
|---|---|---|---|
| Whole-league player list | ✅ | ❌ | ⚠️ Needs setup |
| Advanced xG metrics | ✅ | ⚠️ | ❌ |
| Parsed numeric output | ✅ | ❌ | ⚠️ |
| Multi-season coverage | ✅ | ⚠️ | ⚠️ |
| Export to CSV/Excel/JSON/XML | ✅ | ❌ | ⚠️ |

### 🚀 How to use

1. Create a free Apify account using [this sign-up link](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the Understat xG Player Stats Scraper.
3. Pick a `league`, set a `season` year, and set `maxItems`.
4. Click **Start** and watch the dataset fill in real time.
5. Export your results as CSV, Excel, JSON, or XML, or pull them via API.

### 💼 Business use cases

**📈 Performance analysis**
| Goal | How |
|---|---|
| Find over performers | Compare goals against xG |
| Spot creators | Rank by xA and key passes |

**🎲 Betting and trading**
| Goal | How |
|---|---|
| Build models | Use xG and npxG as inputs |
| Track form | Pull recent seasons |

**🔭 Scouting**
| Goal | How |
|---|---|
| Compare targets | Line up xG output per player |
| Filter by role | Read the position field |

**📊 Research**
| Goal | How |
|---|---|
| Study leagues | Aggregate players by season |
| Track trends | Compare seasons over time |

### 🔌 Automating Understat xG Player Stats Scraper

Connect this Actor to your stack with Apify integrations: **Make**, **Zapier**, **Slack**, **Airbyte**, **GitHub**, and **Google Drive**. Schedule runs and push fresh xG data into spreadsheets, databases, or alerts.

### 🌟 Beyond business use cases

- **Research:** study how expected goals predict outcomes.
- **Personal:** settle debates about your favorite players.
- **Non-profit:** support grassroots football analytics.
- **Experimentation:** build prediction projects with real data.

### 🤖 Ask an AI assistant

Paste your dataset into [ChatGPT](https://chat.openai.com), [Claude](https://claude.ai), [Perplexity](https://www.perplexity.ai), or [Copilot](https://copilot.microsoft.com) and ask for the biggest over performers, top creators by xA, or finishing efficiency.

### ❓ Frequently Asked Questions

**1. Which leagues are covered?**
Premier League, La Liga, Bundesliga, Serie A, Ligue 1, and the Russian Premier League.

**2. How far back does the data go?**
To the 2014/2015 season.

**3. What does the season number mean?**
It is the start year. 2024 returns the 2024/2025 season.

**4. What is xG?**
Expected goals, an estimate of how likely each shot was to score.

**5. What advanced metrics are included?**
xG, xA, non penalty xG, xGChain, and xGBuildup.

**6. Are the values numbers or text?**
Numbers. xG style values are rounded to two decimals.

**7. What export formats are supported?**
CSV, Excel, JSON, XML, and API.

**8. Do I need an API key?**
No. The Actor uses publicly available data.

**9. Can I run it on a schedule?**
Yes, with Apify Schedules and integrations.

**10. Is there a free option?**
Yes. Free runs are limited to 10 items as a preview. Paid plans unlock up to 1,000,000.

### 🔌 Integrate with any app

Use the Apify API, webhooks, and 5,000-plus integrations to push Understat data into Make, Zapier, Google Sheets, Airtable, databases, and more.

### 🔗 Recommended Actors

- [FBref Scraper](https://apify.com/parseforge/fbref-scraper)
- [Sofascore Live Scraper](https://apify.com/parseforge/sofascore-live-scraper)
- [Transfermarkt Scraper](https://apify.com/parseforge/transfermarkt-scraper)
- [FlashScore Scraper](https://apify.com/parseforge/flashscore-scraper)
- [Football-Data.org Scraper](https://apify.com/parseforge/football-data-org-competitions-scraper)

> 💡 **Pro Tip:** browse the complete [ParseForge collection](https://apify.com/parseforge).

**🆘 Need Help?** [Open our contact form](https://tally.so/r/BzdKgA)

> **⚠️ Disclaimer:** independent tool, not affiliated with Understat. Only publicly available data is collected.

# Actor input Schema

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

Football league to scrape.

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

Season start year, from 2014 to the current season (e.g. 2024 for 2024/2025).

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

Free users: limited to 10 items (preview). Paid users: optional, max 1,000,000.

## Actor input object example

```json
{
  "league": "EPL",
  "season": 2024,
  "maxItems": 10
}
```

# 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 = {
    "season": 2024,
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/understat-xg-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 = {
    "season": 2024,
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/understat-xg-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 '{
  "season": 2024,
  "maxItems": 10
}' |
apify call parseforge/understat-xg-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Understat xG Player Stats Scraper",
        "description": "Pull player expected goals data from Understat for the top European leagues. Each player returns games, minutes, goals, assists, shots, xG, xA, non penalty xG, xGChain, and xGBuildup for a chosen season. Great for football analytics, model building, and player scouting.",
        "version": "0.1",
        "x-build-id": "1IgeFgzPSv8MkuoPX"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/parseforge~understat-xg-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-parseforge-understat-xg-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/parseforge~understat-xg-scraper/runs": {
            "post": {
                "operationId": "runs-sync-parseforge-understat-xg-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/parseforge~understat-xg-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-parseforge-understat-xg-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",
                "required": [
                    "league",
                    "season"
                ],
                "properties": {
                    "league": {
                        "title": "League",
                        "enum": [
                            "EPL",
                            "La_liga",
                            "Bundesliga",
                            "Serie_A",
                            "Ligue_1",
                            "RFPL"
                        ],
                        "type": "string",
                        "description": "Football league to scrape.",
                        "default": "EPL"
                    },
                    "season": {
                        "title": "Season (start year)",
                        "minimum": 2014,
                        "maximum": 2026,
                        "type": "integer",
                        "description": "Season start year, from 2014 to the current season (e.g. 2024 for 2024/2025)."
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 1000000,
                        "type": "integer",
                        "description": "Free users: limited to 10 items (preview). Paid users: optional, max 1,000,000."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
