Forums

Download all my games

Sort:
HaydenPanettiere

Hello everyone.

I not seeΒ  Download all my games in one PGN anymore , not can find it anymore.

Thanks !

Kansha

Hey HAYDENFANXOX, unfortunately we no longer have that option available, sorry :(

When someone would download all their games it would take a toll on the server since they were downloading all games ever played on the site which in some cases was thousands of games.

HaydenPanettiere

Ok, thank U so much for the info Kansha

Kansha

You're welcome !

CountEgmont

I want that featre back or i will cancel my subscription.

CGoldthorpe

I would like to know how to, at very least, grab one game at a time and append it to the pgn file of my choice, in PGN format. You can always limit the number of games downloaded per day. How about letting someone only download games played in the last X days??

Can I get ANY of my games at all?

MSC157

I guess it's around 50. I mean, one page.

Kansha

CGoldthorpe, yes you can download games.Β 

Go to your games archive -Β http://www.chess.com/home/game_archive?member=CGoldthorpe

Then click "view" on the game that you want to download.

On the new page, click "get PGN" on the right hand side of the screen, next to the move box. This will cause your game PGN to automatically be downloaded to your PC.

You can also go to your games archive, then click "select all" then click "download pgn" and you will be able to download an entire page of games!

Hopefully that helps :)

Kelvin_Mbugua

Can I just download all the games on a certain specific time control I have ever played

Martin_Stahl
unbane wrote:

Can I just download all the games on a certain specific time control I have ever played

Unless you have very few games, there's no way through the interface to do it. If you can program, you can use the Public API but that will have all games in the archives that can be pulled, on the monthly archives.

IlliquidAsset

I had ChatGPT write a Python script for me. This grabs all your games for all time, except for some reason I'm not getting the last 19 days. Maybe some of you smart folks can figure it out:

```

import requests
import time

# User-specific settings
username = "IlliquidAsset" # Replace with your Chess.com username
contact_email = "[email protected]" # Replace with your contact email

# Set up headers to mimic a browser request and include a user-agent with contact info
headers = {
'User-Agent': f'my-profile-tool/1.2 (username: {username}; contact: {contact_email})',
'Accept-Encoding': 'gzip',
'Accept': 'application/json, text/plain, */*'
}

# Function to fetch the list of archives (months/years with games)
def fetch_archives(username):
url = f"https://api.chess.com/pub/player/{username}/games/archives"
response = requests.get(url, headers=headers)
if response.status_code == 200:
try:
return response.json().get('archives', [])
except requests.exceptions.JSONDecodeError:
print("Error: Received non-JSON response")
print(response.text) # Debug: Print the raw response for further inspection
return []
else:
print(f"Error: Failed to fetch archives. Status Code: {response.status_code}")
print(response.text) # Debug: Print the raw response for further inspection
return []

# Function to fetch PGNs from a list of archive URLs
def fetch_pgns(archive_list):
all_pgns = ""
for archive_url in archive_list:
# Delay between requests to avoid rate limiting
time.sleep(1)

pgn_response = requests.get(f"{archive_url}/pgn", headers=headers)
print(f"Fetching PGNs from {archive_url}, Status Code: {pgn_response.status_code}")
if pgn_response.status_code == 200:
all_pgns += pgn_response.text + "\n\n" # Add some space between games
elif pgn_response.status_code == 429:
print(f"Rate limit exceeded. Retrying after a delay.")
time.sleep(60) # Wait for 60 seconds before retrying
pgn_response = requests.get(f"{archive_url}/pgn", headers=headers)
if pgn_response.status_code == 200:
all_pgns += pgn_response.text + "\n\n"
else:
print(f"Failed to fetch PGNs from {archive_url}")

return all_pgns

# Main function to run the script
def main():
print(f"Fetching game archives for user: {username}")
archive_list = fetch_archives(username)
if archive_list:
print(f"Found {len(archive_list)} archives. Fetching games...")
all_pgns = fetch_pgns(archive_list)
# Write all PGNs to a single file
filename = f"{username}_all_games.pgn"
with open(filename, "w") as pgn_file:
if all_pgns.strip(): # Ensure there is something to write
pgn_file.write(all_pgns)
print(f"All games have been saved to {filename}")
else:
print("No PGNs were fetched.")
else:
print("No archives found or unable to fetch archive list.")

if __name__ == "__main__":
main()

Gobolinno

For someone that doesn't know anything about python scripts.... what do I do with that? O.O...Β 
I mean, I copy it and.... ?

mgeneral

The python file above works (just need to format it a bit - since python is indent based). The formatting is lost when you cut and paste - a formatted file image is below.

You need to download python3 and run as

python3 download.py

where download.py is the downloaded python file. The reason why the last 19 days is not downloading is probably because the archive for the current month is not available.