# Football xG Scraper: Understat Matches, Shots & Tables (`serenido/football-xg-scraper`) Actor

Understat xG data as clean rows: xG league tables, fixtures and results with xG and win probabilities, team match logs (xG, xGA, PPDA), player stats per 90, every shot with xG, lineups and player match logs. Premier League, La Liga, Bundesliga, Serie A, Ligue 1. No login.

- **URL**: https://apify.com/serenido/football-xg-scraper.md
- **Developed by:** [Serenido](https://apify.com/serenido) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 row saveds

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

### What does Football xG Scraper do?

It gets **expected goals (xG) data from [Understat](https://understat.com)** as clean rows you can open in Excel, Google Sheets, Python or R. No login, no cookies, no API key.

- **Leagues:** Premier League, La Liga, Bundesliga, Serie A, Ligue 1, Russian Premier League
- **Seasons:** 2014/15 to the current 2026/27 season (updated after every match on Understat)
- **7 modes:** xG league table, matches, team match logs, player stats, shots, lineups, player match logs

Built for football analysts, betting and fantasy modellers, scouts, journalists and students who need xG without copying tables by hand.

### What data can I get?

| Mode | One row per | Main fields |
|---|---|---|
| **xG league table** | team | points, xPts, points minus xPts, xG, xGA, xGD, npxG, PPDA, deep passes, xPts position. Optional form table from the last N matches |
| **Matches** | fixture or result | kickoff, teams, score, home and away xG, Understat's win / draw / loss probabilities from the match xG |
| **Team match logs** | team per match | opponent, home/away, result, xG, xGA, npxG, xPts, PPDA, opponent PPDA, deep passes |
| **Player stats** | player per season | minutes, goals, assists, shots, key passes, xG, npxG, xA, xGChain, xGBuildup, goals minus xG, per 90 numbers |
| **Shots** | shot | minute, player, assisted by, result, xG, x and y position, situation (open play, set piece, penalty), shot type, last action |
| **Lineups** | player per match | position, minutes, goals, shots, xG, xA, key passes, xGChain, xGBuildup, cards |
| **Player match logs** | player per match | every match of a player with minutes, goals, xG, npxG, xA, key passes, xGChain |

### Example output

xG league table, Premier League 2026/27 (real run, 16 October 2026):

| position | team | played | points | xG | xGA | xPts | pointsMinusXPts | ppda |
|---|---|---|---|---|---|---|---|---|
| 1 | Manchester City | 6 | 18 | 12.63 | 7.94 | 11.72 | 6.28 | 8.57 |

A shot from the same run:

```json
{
  "type": "shot",
  "league": "Premier League (England)",
  "season": "2026/27",
  "matchId": "31239",
  "date": "2026-10-12 19:00:00",
  "homeTeam": "Coventry",
  "awayTeam": "Newcastle United",
  "minute": 5,
  "team": "Coventry",
  "player": "Jack Rudoni",
  "result": "Goal",
  "isGoal": true,
  "xG": 0.7612,
  "x": 0.885,
  "y": 0.5,
  "situation": "Penalty",
  "shotType": "LeftFoot"
}
```

Every row of a type has the same columns in the same order, so exports open cleanly in a spreadsheet. Each mode has its own table view in the Output tab.

### How to use it

1. Pick a **mode**.
2. Pick one or more **leagues** and **seasons** (start year: `2026` = 2026/27, or write `current`).
3. Click **Start**. A league table takes a few seconds.

For **shots** and **lineups**, either paste Understat match links (`https://understat.com/match/28778`) or leave them empty to get the most recent played matches of your leagues (set **Max matches**). For **player match logs**, paste player links (`https://understat.com/player/8260`).

#### Input examples

Form table from the last 5 matches, two leagues:

```json
{ "mode": "table", "leagues": ["EPL", "La_liga"], "seasons": ["current"], "lastMatches": 5 }
```

All shots from the last 50 Premier League matches:

```json
{ "mode": "shots", "leagues": ["EPL"], "maxMatches": 50 }
```

Upcoming Serie A fixtures:

```json
{ "mode": "matches", "leagues": ["Serie_A"], "matchStatus": "fixtures" }
```

### What do the numbers mean?

Definitions as Understat gives them:

- **xG**: the chance a shot becomes a goal, from 0 to 1, as estimated by Understat. A team's xG is the sum of its shots.
- **npxG**: xG without penalties and own goals.
- **xA**: the sum of xG of shots from a player's key passes.
- **xPts**: points a team would expect from its xG and xGA in each match.
- **PPDA**: passes allowed per defensive action in the opposition half. Lower = more pressing. **oppda** is the same for the opponent.
- **deep**: passes completed within an estimated 20 yards of goal, crosses excluded. **deepAllowed** is the same for the opponent.
- **xGChain**: total xG of every possession the player is involved in. **xGBuildup**: the same without key passes and shots.
- **x, y** (shots): position on the pitch from 0 to 1, as given by Understat.
- **xgWinProbHome / xgDrawProb / xgWinProbAway** (played matches): Understat's probabilities computed from the match xG.

Times are as listed by Understat.

### How much does it cost?

You pay only for rows saved to the dataset. Matches, players or seasons that do not exist are skipped and never charged, and the run's status message lists them. Apify's free plan includes monthly usage credit, which covers many runs.

### Can I use it from AI agents or code?

Yes. Call it from the Apify API, Python or JavaScript clients, Make, Zapier, n8n, or any MCP client (Claude, ChatGPT, Cursor) through Apify's MCP server: `https://mcp.apify.com?tools=serenido/football-xg-scraper`.

### FAQ

**Which leagues are covered?** The six leagues Understat covers: EPL, La Liga, Bundesliga, Serie A, Ligue 1, RFPL. Other leagues are not on Understat.

**How fresh is the data?** Each run reads Understat live, so you get exactly what Understat shows at that moment.

**Why is a season empty?** Understat has data from 2014/15. A season that has not started yet has no matches.

**Is this affiliated with Understat?** No. This scraper reads Understat's public pages. Please respect Understat's terms and credit Understat when you publish its data.

# Actor input Schema

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

Pick one per run. Every mode uses Understat's public data, no login.

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

One or more leagues. Used by every mode except player match logs and shots/lineups for given match links.

## `seasons` (type: `array`):

Start year of the season, from 2014 to now: 2026 = 2026/27. You can also write 2025/26 or current. Empty = current season.

## `matchStatus` (type: `string`):

Matches mode only.

## `dateFrom` (type: `string`):

Optional. Only matches on or after this day (YYYY-MM-DD). Works in matches, team match logs, shots, lineups and player match logs.

## `dateTo` (type: `string`):

Optional. Only matches on or before this day (YYYY-MM-DD).

## `lastMatches` (type: `integer`):

Table mode only. 0 = whole season. 5 = a table built from each team's last 5 matches (form).

## `minMinutes` (type: `integer`):

Players mode only. Skip players with fewer minutes (per-90 numbers are noisy below ~450).

## `matchUrls` (type: `array`):

Optional. Understat match links like https://understat.com/match/28778 or just 28778. Empty = the most recent played matches of the leagues and seasons above.

## `maxMatches` (type: `integer`):

When no match links are given: how many of the most recent played matches to read. A full league season is 306 to 380 matches.

## `playerUrls` (type: `array`):

Player match logs mode. Understat player links or ids. Add seasons above to keep only those seasons; leave seasons empty for the full career on Understat.

## `maxConcurrency` (type: `integer`):

Used for shots, lineups and player match logs.

## `proxy` (type: `object`):

Not needed: the scraper connects directly and falls back to Apify Proxy on its own if Understat slows it down.

## Actor input object example

```json
{
  "mode": "table",
  "leagues": [
    "EPL"
  ],
  "seasons": [
    "current"
  ],
  "matchStatus": "all",
  "lastMatches": 0,
  "minMinutes": 0,
  "maxMatches": 50,
  "playerUrls": [
    "https://understat.com/player/8260"
  ],
  "maxConcurrency": 4
}
```

# Actor output Schema

## `view_tableRow` (type: `string`):

No description

## `view_match` (type: `string`):

No description

## `view_teamMatch` (type: `string`):

No description

## `view_player` (type: `string`):

No description

## `view_shot` (type: `string`):

No description

## `view_lineup` (type: `string`):

No description

## `view_playerMatch` (type: `string`):

No description

## `all` (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 = {
    "seasons": [
        "current"
    ],
    "playerUrls": [
        "https://understat.com/player/8260"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("serenido/football-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 = {
    "seasons": ["current"],
    "playerUrls": ["https://understat.com/player/8260"],
}

# Run the Actor and wait for it to finish
run = client.actor("serenido/football-xg-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 '{
  "seasons": [
    "current"
  ],
  "playerUrls": [
    "https://understat.com/player/8260"
  ]
}' |
apify call serenido/football-xg-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,serenido/football-xg-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/cRJeFZgChe3aQnJ83/builds/cKGA3Wkp4QuyxV07C/openapi.json
