-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Chess.com seems to have two IDs on each game. For example, this game:
https://www.chess.com/game/live/89158193969
has 89158193969 in the URL. This is the ID the Python script is getting from chess.com API. However, this is not the ID we need to create an embeddable board. Click the share icon, and click the Embed tab to get the embeddable board code:
<iframe id="11059587" allowtransparency="true" frameborder="0" style="width:100%;border:none;" src="//www.chess.com/emboard?id=11059587"></iframe><script>window.addEventListener("message",e=>{e['data']&&"11059587"===e['data']['id']&&document.getElementById(`${e['data']['id']}`)&&(document.getElementById(`${e['data']['id']}`).style.height=`${e['data']['frameHeight']+30}px`)});</script>
This is the same game, but the code has a different ID, 11059587. I actually suspect chess.com is generating these IDs only when a user clicks Embed, because I created one for a different game a few minutes earlier, and the ID it gave me was 11059573.
I did try the embed code with the other ID, and it doesn't work.
If it's not possible for the Python script to return these alternate IDs, a fallback plan could be for the Python code to return the FEN for the position. The UI would then be able to show a static board and a link to the game.