Skip to content

Instantly share code, notes, and snippets.

View LalleSX's full-sized avatar

Lalle LalleSX

  • Denmark
  • 18:27 (UTC +01:00)
View GitHub Profile
@LalleSX
LalleSX / pgn.py
Created April 23, 2023 03:48
Download all your Chess.com games to PGN
import requests
import os
## Set your username at the bottom of this file
def download_games(username, output_directory):
url = f"https://api.chess.com/pub/player/{username}/games/archives"
response = requests.get(url)
if response.status_code != 200:
print(f"Error: Unable to access user archives at {url}")
return