# Sports Data Scraper — Teams, Fixtures & Players (`hipersoft/thesportsdb-scraper`) Actor

Fetch sports teams, fixtures, results and players from TheSportsDB across football, basketball, NFL, NHL and many more leagues. One clean row per team, event or player with names, leagues, scores, venues and stats. Fast and reliable for sports apps, stats dashboards and n8n.

- **URL**: https://apify.com/hipersoft/thesportsdb-scraper.md
- **Developed by:** [hiper soft](https://apify.com/hipersoft) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0005 / item scraped

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?

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

## Sports Data Scraper — Teams, Fixtures, Results & Players

Sports Data Scraper pulls **teams, fixtures, past results and player profiles** across football (soccer), basketball, American football, ice hockey, baseball and many more leagues worldwide — all as clean, structured data. Search teams or players by name, list every team in a league, and fetch upcoming fixtures or recent results for any team. Export to JSON, CSV, Excel or XML. Fast, reliable, and built for sports apps, stats dashboards, fantasy tools and automation workflows.

### What does this Sports Scraper do?

Pick a **mode**, add a couple of parameters, and it returns every matching record as structured data:

- **Search teams** by name (e.g. `Arsenal`) — get the club, its league, sport, stadium, country, year formed and badge.
- **League teams** — list every team in a league by id or name.
- **Next events** — upcoming fixtures for a team.
- **Past events** — recent results and scores for a team.
- **Search players** by name — position, team, nationality and more.
- **Leagues** — list all supported leagues with their ids.

### What data can you get?

| Data point | Description |
| --- | --- |
| Team | `name`, `shortName`, `alternateNames`, `sport`, `league`, `formedYear` |
| Venue | `stadium`, `stadiumCapacity`, `location`, `country` |
| Branding | `badge`, `logo`, `website` |
| Fixture / result | `name`, `date`, `homeTeam`, `awayTeam`, `homeScore`, `awayScore`, `venue`, `season`, `round` |
| Player | `name`, `team`, `position`, `nationality`, `dateBorn`, `status` |
| League | `leagueId`, `name`, `sport` |

### What you get

Each team, event, player or league is one clean dataset record. Export the full table to JSON, CSV, Excel or XML, or pull it programmatically.

```json
{
  "mode": "searchTeams",
  "recordType": "team",
  "teamId": "133604",
  "name": "Arsenal",
  "shortName": "ARS",
  "sport": "Soccer",
  "league": "English Premier League",
  "leagueId": "4328",
  "formedYear": 1892,
  "stadium": "Emirates Stadium",
  "stadiumCapacity": 60338,
  "location": "Holloway, London, England",
  "country": "England",
  "badge": "https://.../arsenal/badge.png"
}
```

#### Output schema

Fields below are for the `searchTeams` / `leagueTeams` modes. The event and player modes return their own record shapes (fixtures/results and player profiles respectively), and each row carries a `recordType` so you can tell them apart.

| Field | Type | Description |
| --- | --- | --- |
| `mode` | string | The mode that produced the record. |
| `recordType` | string | `team`, `event`, `player` or `league`. |
| `teamId` | string | Unique identifier for the team. |
| `name` | string | Team name (e.g. "Arsenal"). |
| `shortName` | string | Short code (e.g. "ARS"). |
| `sport` | string | Sport the team plays (e.g. "Soccer"). |
| `league` | string | Primary league name. |
| `leagueId` | string | Numeric league identifier. |
| `formedYear` | integer | Year the team was founded. |
| `stadium` | string | Home stadium or arena. |
| `stadiumCapacity` | integer | Stadium capacity. |
| `location` | string | City / area of the club. |
| `country` | string | Country the team belongs to. |
| `badge` | string | URL of the team badge image. |

### Use cases

- Build league tables and team directories for a sports site or app.
- Pull upcoming fixtures into a schedule or calendar.
- Backfill recent results and scores for a stats or analytics dataset.
- Enrich fantasy and betting tools with player positions and nationalities.
- Feed team badges and metadata into a media dashboard.

### How to use the Sports Data Scraper

1. Add the Sports Data Scraper to your Apify account and open its input.
2. Choose a **mode**: searchTeams, leagueTeams, nextEvents, pastEvents, searchPlayers or leagues.
3. Fill the matching parameter — `query` for searches, `leagueId`/`leagueName` for league teams, or `teamId` for events.
4. Click **Run**.
5. Export the results as JSON, CSV, Excel or XML, or pull them via the Apify API.

### Input

```json
{
  "mode": "searchTeams",
  "query": "Arsenal"
}
```

| Field | Description |
| --- | --- |
| `mode` | `searchTeams`, `leagueTeams`, `nextEvents`, `pastEvents`, `searchPlayers` or `leagues`. |
| `query` | Team or player name for the search modes. |
| `leagueId` | Numeric league id for `leagueTeams` (e.g. 4328). |
| `leagueName` | League name for `leagueTeams` when you do not have the id. |
| `teamId` | Numeric team id for `nextEvents` and `pastEvents`. |

### Tip: chaining modes

Don't know an id? Run `leagues` to list league ids, `searchTeams` (or `leagueTeams`) to get team ids, then feed a `teamId` into `nextEvents` or `pastEvents` for fixtures and results.

### Need more sports & media data?

- [ESPN Sports Scraper](https://apify.com/hipersoft/espn-sports-scraper) — live scores, teams, standings and news.
- [TVmaze Scraper](https://apify.com/hipersoft/tvmaze-scraper) — TV shows, episodes and cast data.
- [Google News Scraper](https://apify.com/hipersoft/google-news-scraper) — news headlines and articles by keyword.

### FAQ

**Which sports and leagues are covered?**
Football (soccer), basketball, American football, ice hockey, baseball, motorsport and many more, across leagues worldwide. Run the `leagues` mode to see the full list with ids.

**How do I find a team or league id?**
Run `searchTeams` or `leagueTeams` to get team ids, and `leagues` to get league ids. You can also pass `leagueName` and let the scraper resolve the id for you.

**What export formats are supported?**
JSON, CSV, Excel and XML, plus programmatic access through the Apify API.

**How does billing work?**
You pay per item you get, so cost scales with the number of records you actually collect. See the **Pricing** tab for current rates.

**Can I use this with n8n?**
Yes. Run the Sports Data Scraper from [n8n](https://n8n.io) with the Apify node — trigger a run, pass your `mode` and parameters, and read the dataset items straight into your workflow. It also works with Make, Zapier and the Apify API.

**Can I connect this to other tools?**
The Sports Data Scraper connects with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). It works with [Make](https://apify.com/integrations/make), [Zapier](https://apify.com/integrations/zapier), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [GitHub](https://docs.apify.com/platform/integrations/github), [Google Drive](https://docs.apify.com/platform/integrations/drive) and [many more](https://apify.com/integrations), plus the [Apify API](https://docs.apify.com/api/v2), JavaScript/Python clients and MCP. Or use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to trigger an action whenever a run finishes.

### Related Actors

- [ESPN Sports Scraper](https://apify.com/hipersoft/espn-sports-scraper)
- [TVmaze Scraper](https://apify.com/hipersoft/tvmaze-scraper)
- [Google News Scraper](https://apify.com/hipersoft/google-news-scraper)

### Notes

Original clean-room implementation. Reads only publicly available sports information. Not affiliated with, endorsed by or connected to TheSportsDB or any league, team or competition.

# Actor input Schema

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

What to fetch: searchTeams (find teams by name), leagueTeams (all teams in a league), nextEvents (upcoming fixtures for a team), pastEvents (recent results for a team), searchPlayers (find players by name), or leagues (list all supported leagues).

## `query` (type: `string`):

Search term used by searchTeams and searchPlayers. For example "Arsenal" for a team, or "Danny Welbeck" for a player.

## `leagueId` (type: `string`):

Numeric league id used by leagueTeams (e.g. 4328 for the English Premier League). Run the leagues mode first to look ids up. Takes priority over League name if both are set.

## `leagueName` (type: `string`):

League name used by leagueTeams when you do not have the id (e.g. "English Premier League"). Resolved to an id automatically. Ignored if League ID is set.

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

Numeric team id used by nextEvents and pastEvents (e.g. 133604 for Arsenal). Run searchTeams or leagueTeams first to look ids up.

## Actor input object example

```json
{
  "mode": "searchTeams",
  "query": "Arsenal",
  "leagueId": "4328",
  "leagueName": "English Premier League",
  "teamId": "133604"
}
```

# Actor output Schema

## `results` (type: `string`):

The results as dataset items.

# 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 = {
    "query": "Arsenal"
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/thesportsdb-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 = { "query": "Arsenal" }

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/thesportsdb-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 '{
  "query": "Arsenal"
}' |
apify call hipersoft/thesportsdb-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,hipersoft/thesportsdb-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/u5IwQBH9ocG6LRmKf/builds/NXVJwjNMXlNEIxjsN/openapi.json
