Fetches game data for a given user from the Lichess API in NDJSON format.
Usage
lic_games_user(
username,
perf_type = NULL,
since = NULL,
until = NULL,
max = NULL,
vs = NULL,
rated = NULL,
color = NULL,
analysed = NULL,
opening = TRUE,
moves = TRUE,
clocks = FALSE,
evals = FALSE,
token = lic_token()
)
lic_get_games(
username,
perf_type = NULL,
since = NULL,
until = NULL,
max = NULL,
vs = NULL,
rated = NULL,
color = NULL,
analysed = NULL,
opening = TRUE,
moves = TRUE,
clocks = FALSE,
evals = FALSE,
token = lic_token()
)Arguments
- username
Lichess username.
- perf_type
Optional game type filter (e.g.
"bullet","blitz","rapid","classical").- since
Download games played since this timestamp or Date (e.g.
"2025-01-01"oras.Date(...)).- until
Download games played until this timestamp or Date.
- max
Maximum number of games to download. Default is
NULL(all games).- vs
Filter for games played against a specific opponent username.
- rated
Logical. Whether to fetch only rated games. Default is
NULL.- color
Filter for player's color:
"white"or"black".- analysed
Logical. Whether to fetch only games with computer analysis.
- opening
Logical. Whether to include opening name and ECO code. Default is
TRUE.- moves
Logical. Whether to include PGN moves string. Default is
TRUE.- clocks
Logical. Whether to include clock times for each move. Default is
FALSE.- evals
Logical. Whether to include Stockfish evaluations. Default is
FALSE.- token
API access token. By default, retrieved via
lic_token().
Value
A tibble::tibble containing raw game records.
Details
Lichess API Endpoint: GET /api/games/user/{username}
Official Documentation: https://lichess.org/api#tag/Games/operation/apiGamesUser
Rate limits: Anonymous requests are throttled at 20 games/sec. Authenticated OAuth requests receive 30 games/sec (or 60 games/sec when fetching your own games).
Examples
games <- lic_games_user("h8gi", perf_type = "bullet", max = 5)
games
#> # A tibble: 2 × 18
#> id rated variant speed perf createdAt lastMoveAt status winner moves
#> <chr> <lgl> <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr>
#> 1 demoGame1 TRUE standard bullet bull… 1.73e12 1.73e12 resign white e4 e…
#> 2 demoGame2 TRUE standard bullet bull… 1.73e12 1.73e12 mate black d4 d…
#> # ℹ 8 more variables: players.white.rating <int>,
#> # players.white.user.name <chr>, players.white.user.id <chr>,
#> # players.black.rating <int>, players.black.user.name <chr>,
#> # players.black.user.id <chr>, opening.eco <chr>, opening.name <chr>