# Lichess Scraper - Player Profiles, Ratings & Leaderboards (`ninhothedev/lichess-scraper`) Actor

$0.5/1K 🔥 Lichess scraper! Player profiles, ratings, stats & leaderboards. No key. JSON, CSV, Excel or API in seconds. Power chess analytics, apps & dashboards ⚡

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

## Pricing

from $0.50 / 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.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#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

## Lichess Scraper — Player Profiles, Ratings, Stats & Leaderboards

Scrape **Lichess** player data and top leaderboards straight from the public Lichess API — **no API key, no login, no cookies**. Feed it a list of usernames to get full profiles (ratings across every time control, game counts, win/loss/draw, play time, FIDE rating, country) or pull the **top players** for any perf type.

Fast, cheap, and structured. Great for chess analytics, player research, coaching dashboards, and powering your own chess apps.

> Estimated cost: **~$0.50 per 1,000 records** on the Apify platform.

***

### Features

- 👤 **Player profiles** — resolve any list of usernames into clean, flat rows.
- 🏆 **Leaderboards** — top *N* players for **bullet**, **blitz**, **rapid**, or **classical**.
- ♟️ **All ratings** — bullet, blitz, rapid, classical, and puzzle in one row.
- 📊 **Full stats** — total games, wins, losses, draws, play time (hours).
- 🌍 **Profile extras** — country and FIDE rating when available.
- 🕒 **Clean timestamps** — account created + last seen as ISO-8601 UTC.
- 🔑 **No key required** — public API, Chrome-impersonated requests with a urllib fallback.

***

### Use cases

- **Chess analytics** — track rating trends and activity across many players.
- **Player research** — build datasets of GMs, IMs, and rising talents.
- **Leaderboards** — snapshot the current top of any time control.
- **Chess apps** — power profile lookups and rankings in your own product.

***

### Input

| Field | Type | Description |
| --- | --- | --- |
| `mode` | select | `players` (usernames → profiles) or `leaderboard` (top players). Default `players`. |
| `usernames` | array | Lichess usernames to scrape in `players` mode. Prefilled with `DrNykterstein`, `penguingm1`. |
| `perfType` | select | Rating category for `leaderboard` mode: `bullet` / `blitz` / `rapid` / `classical`. Default `blitz`. |
| `count` | integer | How many top players to fetch (1–200). Default `50`. |
| `maxItems` | integer | Hard cap on output records (1–2000). Default `200`. |

#### Example — player profiles

```json
{
  "mode": "players",
  "usernames": ["DrNykterstein", "penguingm1"],
  "maxItems": 200
}
```

#### Example — leaderboard

```json
{
  "mode": "leaderboard",
  "perfType": "bullet",
  "count": 50
}
```

***

### Output

**Player record** (`mode: players`):

```json
{
  "username": "DrNykterstein",
  "title": "GM",
  "country": "NO",
  "fide_rating": 2839,
  "bullet_rating": 3243,
  "blitz_rating": 3153,
  "rapid_rating": 2500,
  "classical_rating": 2500,
  "puzzle_rating": 2812,
  "total_games": 10450,
  "wins": 7207,
  "losses": 2409,
  "draws": 834,
  "play_time_hours": 325,
  "created_at": "2018-12-06T...",
  "seen_at": "2026-...",
  "url": "https://lichess.org/@/DrNykterstein",
  "source": "lichess",
  "scraped_at": "2026-..."
}
```

**Leaderboard record** (`mode: leaderboard`):

```json
{
  "type": "leaderboard",
  "perf": "bullet",
  "rank": 1,
  "username": "mraquariyaz67",
  "title": "GM",
  "rating": 3407,
  "source": "lichess",
  "scraped_at": "2026-..."
}
```

All fields are nullable — missing data comes back as `null` rather than breaking the run.

***

### How it works

The Actor calls the official public Lichess endpoints:

- `GET /api/user/{username}` for profiles
- `GET /api/player/top/{count}/{perfType}` for leaderboards

Requests use `curl_cffi` with Chrome impersonation and automatically fall back to `urllib` if needed. Usernames are fetched in batches and deduplicated.

***

### Related Actors

- [Chess.com Player Scraper](https://apify.com/ninhothedev/chess-com-player-scraper)
- [Twitch Channel Scraper](https://apify.com/ninhothedev/twitch-channel-scraper)
- [Steam Games Scraper](https://apify.com/ninhothedev/steam-games-scraper)
- [Pokemon Scraper](https://apify.com/ninhothedev/pokemon-scraper)

***

### FAQ

**Do I need a Lichess API key?** No. All endpoints used are public.

**Is this affiliated with Lichess?** No. Lichess is a trademark of its owners; this is an independent tool built on their open API. Please respect the [Lichess Terms of Service](https://lichess.org/terms-of-service).

**What if a username doesn't exist?** It's skipped with a warning; the run continues.

# Actor input Schema

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

What to scrape. 'players' resolves a list of usernames into full profiles. 'leaderboard' fetches the top players for a chosen perf type.

## `usernames` (type: `array`):

List of Lichess usernames to scrape (used when mode = 'players'). Case-insensitive.

## `perfType` (type: `string`):

Which rating category to rank when mode = 'leaderboard'.

## `count` (type: `integer`):

How many top players to fetch when mode = 'leaderboard' (1-200).

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

Hard cap on the number of records written to the dataset.

## Actor input object example

```json
{
  "mode": "players",
  "usernames": [
    "DrNykterstein",
    "penguingm1"
  ],
  "perfType": "blitz",
  "count": 50,
  "maxItems": 200
}
```

# 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 = {
    "usernames": [
        "DrNykterstein",
        "penguingm1"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninhothedev/lichess-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 = { "usernames": [
        "DrNykterstein",
        "penguingm1",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ninhothedev/lichess-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 '{
  "usernames": [
    "DrNykterstein",
    "penguingm1"
  ]
}' |
apify call ninhothedev/lichess-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/mv534Qi0BMDMaS3K8/builds/8d191xECzTOubVZbk/openapi.json
