Skip to content

rosen-score/chess-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a584417 · Dec 12, 2024
May 9, 2024
Mar 28, 2024
Mar 28, 2024
Aug 8, 2022
Aug 8, 2022
Aug 8, 2022
Jan 13, 2024
Jan 21, 2023
Dec 12, 2024
May 9, 2024
Feb 6, 2024
Jan 13, 2024

Repository files navigation

Chess Fetcher

Typescript library for fetching chess games. Handles fetching and ndjson parsing. Returns data in a standard format.

Installation

npm install chess-fetcher

Usage

// Fetch a player's profile (public info, rating, game stats)
player('https://lichess.org/@/DrNykterstein').then((player) => {
    console.log(player)
})

// Fetch games of a player or tournament
games('https://lichess.org/@/DrNykterstein', (game) => {
    console.log(`${game.players.white.username} vs ${game.players.black.username}`, game.result.label)
}).then(() => console.log('done'))

Demo

npx tsx demo.ts

Development Notes

How to release a new version

npm version 0.x.x
git push origin main --tags

Github workflow will auto publish it to npm.

Linking as a local package

cd chess-fetcher
npm link
cd ../rosen-score
npm uninstall chess-fetcher
npm link chess-fetcher

After making any changes to chess-fetcher, run npm run build to update the symlink'ed code for rosen-score.