Public
Script
Readme

Fetches the PGN for a Lichess game.

1
2
3
4
5
6
7
8
9
10
11
import { fetch } from "https://esm.town/v/std/fetch";
export const lichessPgn = async (gameId: string) => {
const game = await fetch(`https://lichess.org/game/export/${gameId}`, {
headers: {
// Doesn't seem to actually want to do JSON :(
"Content-Type": "application/json",
},
});
return await game.text();
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023