I would like to make something that has the capability to convert a chess game in chess.com to a text-to-speech output (for example to play blindfolded.) I know this has been made before, but I'm not looking for the product but rather the process. Is there a way to extract moves as they are being made or the PGN or something like that from a live chess.com game while it's happening? Assume I know everything I need to know, just give me the explanation if possible.
2 Answers
You can just scrape the HTML. Here's a picture of the HTML that chess.com uses to store moves:
Most modern languages have ways of scraping HTML on update, so this should solve your problem.
If you click the "Explorer" icon during the game, it will open the Opening Explorer page in a new window. The URL of the page will contain the move list. For example:
https://www.chess.com/explorer?moveList=e4+e5+Nf3+Nc6
If you want the actual PGN, it can also easily be accessed from that page using the normal buttons.
I assume there's some limit as to how many moves are allowed, although I just tried it 35 moves into a game and it still had all the moves.
-
Do you know if there's a way to export this in some way? Feb 8, 2022 at 23:33