# Transfermarkt Scraper (`curious_coder/transfermarkt`) Actor

Scrape and extract data from competition, club or player pages, or almost any Transfermarkt page. Download your data as HTML table, JSON, CSV, Excel, XML, and RSS feed.

- **URL**: https://apify.com/curious_coder/transfermarkt.md
- **Developed by:** [Curious Coder](https://apify.com/curious_coder) (community)
- **Categories:** News
- **Stats:** 2,829 total users, 0 monthly users, 100.0% runs succeeded, 21 bookmarks
- **User rating**: No ratings yet

## Pricing

$15.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

## 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

### Features

Using the **Transfermarkt scraper**, you can extract data from all transfermarkt.com pages and domains. It works best with *competition, club* or *player pages*, but supports other page types as well.

Transfermarkt Scraper **requires only the start page URL**. The page type will be determined automatically, and the scraper will extract all the sports data accordingly. It is fairly simple to use as it only has 3 other input parameters to work with, other than the start page URL.

**How to use the extracted Transfermarkt statistics data:**

- **Scrape live scores** for the most accurate predictions of match outcomes
- **Monitor transfermarkt** and other soccer-related websites simultaneously and combine extracted data
- **Collect the statistics** from the past games needed for analysis and sports results forecasts
- **Create data-based rules** to form an accurate online sports betting strategy
- **Optimize live monitoring** and analysis of what causes the changes in betting rates as well as what information influences betting decisions.

### Cost of usage

Using our basic plan, the scraper's run will cost you around **2.5 USD credits per 1000 scraped results**. For more details about the plans we offer, platform credits and usage, see the [platform pricing page](https://apify.com/pricing/actors).

If you're not sure how much credit you've got on your plan and whether you might need to upgrade, you can always check your limits in the *Settings* -> *Usage and Billing* tab in [your Console](https://console.apify.com/). The easiest way to know how many credits your actor will need is to perform a test run.

### Tutorial

For a more detailed explanation on how to scrape Transfermarkt, read the [Transfermarkt scraper tutorial](https://blog.apify.com/how-to-scrape-transfermarkt/) on our blog.  For more ideas on how to use web scraping data, check out our  [industries pages](https://apify.com/industries)  for ways web scraping results are already being used across the projects and businesses of various scale and direction.

### Input parameters

The Transfermarkt Scraper accepts following parameters:

- **startUrl** *(required)*: The start page URL, from which the scraper will be fending off.
- **parallels**:  Specifies how many parallel crawlers will be used; defaults to value 1.
- **crawlDepth**: defines how deep the crawler will navigate from the start page. Defaults to 1 (extracts data from the start page only), but if you set up a higher value, the crawler will go deeper into the links this page contains.
- **pageDepth**:  defines how far in pagination the run will be extended. By default it's set to unlimited - so if there's, say, 50 indexed pages of results, the crawler will not stop until it will finish scraping all of them.

#### Example

```json
{
    "startUrls": [
        {
            "url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003"
        }
    ],
    "proxyConfig": {
        "useApifyProxy": true
    },
    "crawlDepth": 1,
    "pageDepth": 1
};
```

### Output

The output from Transfermarkt Scraper is stored in the *Apify Dataset*. After the run is finished, you can choose to present and download the contents of the dataset in different data formats (JSON, XML, RSS, HTML Table...)

#### Example

Here's an example output of the scraper when run with the input parameters from the previous example.

```json
{
	"id": "28003",
	"url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003",
	"type": "player",
	"Name in home country": "Lionel Andrés Messi Cuccitini",
	"Date of birth/Age": "Jun 24, 1987 (37)",
	"Place of birth": "Rosario",
	"Height": "1,70 m",
	"Citizenship": [
		"Argentina",
		"Spain"
	],
	"Position": "Attack - Right Winger",
	"Foot": "left",
	"Player agent": "Relatives",
	"Current club": "Inter Miami CF",
	"Joined": "Jul 15, 2023",
	"Contract expires": "Dec 31, 2025",
	"Outfitter": "adidas",
	"Social-Media": "",
	"transfers": [
		{
			"Season": "23/24",
			"Date": "Jul 15, 2023",
			"Left": "Paris SG",
			"Joined": "Miami",
			"MV": "€35.00m",
			"Fee": "free transfer",
			"_i": null
		},
		{
			"Season": "21/22",
			"Date": "Aug 10, 2021",
			"Left": "Barcelona",
			"Joined": "Paris SG",
			"MV": "€80.00m",
			"Fee": "free transfer",
			"_i": null
		},
		{
			"Season": "05/06",
			"Date": "Jul 1, 2005",
			"Left": "Barcelona B",
			"Joined": "Barcelona",
			"MV": "€3.00m",
			"Fee": null,
			"_i": null
		},
		{
			"Season": "03/04",
			"Date": "Mar 5, 2004",
			"Left": "Barcelona C",
			"Joined": "Barcelona B",
			"MV": null,
			"Fee": null,
			"_i": null
		},
		{
			"Season": "03/04",
			"Date": "Nov 28, 2003",
			"Left": "Barça U19",
			"Joined": "Barcelona C",
			"MV": null,
			"Fee": null,
			"_i": null
		},
		{
			"Season": "03/04",
			"Date": "Sep 13, 2003",
			"Left": "Barça U16",
			"Joined": "Barça U19",
			"MV": null,
			"Fee": null,
			"_i": null
		},
		{
			"Season": "02/03",
			"Date": "Jul 1, 2002",
			"Left": "Barça Youth",
			"Joined": "Barça U16",
			"MV": null,
			"Fee": null,
			"_i": null
		},
		{
			"Season": "00/01",
			"Date": "Jul 1, 2000",
			"Left": "Newell's Youth",
			"Joined": "Barça Youth",
			"MV": null,
			"Fee": "free transfer",
			"_i": null
		}
	],
	"careerStats": [
		{
			"Competition": "MLS",
			"Appearances": "12",
			"Goals": "12",
			"Assists": "9",
			"Minutes per goal": "87'",
			"Minutes": "1,035'"
		},
		{
			"Competition": "Copa América 2024",
			"Appearances": "2",
			"Goals": null,
			"Assists": "1",
			"Minutes per goal": null,
			"Minutes": "180'"
		},
		{
			"Competition": "CONCACAF Champions Cup",
			"Appearances": "3",
			"Goals": "2",
			"Assists": "2",
			"Minutes per goal": "115'",
			"Minutes": "230'"
		}
	]
}
```

### Other sports scrapers

We have other sport-related scrapers in stock for you; for instance, see this [Soccer Stats Scraper.](https://apify.com/glosterr/soccerstats-scraper#soccer-stats-scraper)

### Your feedback

We're always working on improving the performance of our actors. So if you've got any feedback about the work of our Transfermarkt API, do not hesitate to drop us a line in `support@apify.com`. If you do so much as to find a bug, please create an issue on the [Github page](https://github.com/cermak-petr/actor-transfermarkt) and we'll get to it.

# Actor input Schema

## `startUrls` (type: `array`):

URLs to start with.

## `proxyConfig` (type: `object`):

Use Apify Proxy or your own to run this actor.

## `crawlDepth` (type: `integer`):

How deep will the crawler follow links from the current page.

## `pageDepth` (type: `integer`):

How far will the crawler follow pagination links.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003"
    },
    {
      "url": "https://www.transfermarkt.com/premier-league/verletztespieler/wettbewerb/GB1"
    },
    {
      "url": "https://www.transfermarkt.com/premier-league/tabelle/wettbewerb/GB1/saison_id/2023"
    }
  ],
  "proxyConfig": {
    "useApifyProxy": true
  },
  "crawlDepth": 1,
  "pageDepth": 1
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003"
        },
        {
            "url": "https://www.transfermarkt.com/premier-league/verletztespieler/wettbewerb/GB1"
        },
        {
            "url": "https://www.transfermarkt.com/premier-league/tabelle/wettbewerb/GB1/saison_id/2023"
        }
    ],
    "proxyConfig": {
        "useApifyProxy": true
    },
    "crawlDepth": 1,
    "pageDepth": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("curious_coder/transfermarkt").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 = {
    "startUrls": [
        { "url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003" },
        { "url": "https://www.transfermarkt.com/premier-league/verletztespieler/wettbewerb/GB1" },
        { "url": "https://www.transfermarkt.com/premier-league/tabelle/wettbewerb/GB1/saison_id/2023" },
    ],
    "proxyConfig": { "useApifyProxy": True },
    "crawlDepth": 1,
    "pageDepth": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("curious_coder/transfermarkt").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 '{
  "startUrls": [
    {
      "url": "https://www.transfermarkt.com/lionel-messi/profil/spieler/28003"
    },
    {
      "url": "https://www.transfermarkt.com/premier-league/verletztespieler/wettbewerb/GB1"
    },
    {
      "url": "https://www.transfermarkt.com/premier-league/tabelle/wettbewerb/GB1/saison_id/2023"
    }
  ],
  "proxyConfig": {
    "useApifyProxy": true
  },
  "crawlDepth": 1,
  "pageDepth": 1
}' |
apify call curious_coder/transfermarkt --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,curious_coder/transfermarkt"
        }
    }
}
```

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/xCCKG4gqfoahQJrEy/builds/PfD9sFcX8DmOri53S/openapi.json
