-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] - getGameByID #10
Comments
Yeah this would be super helpful. I'm also happy to write it if repo owner would merge or provide a little more info on how that could work |
Simular RequestsAfter looking into it, it seems like this is definitely a feature / related to other features devs have been asking for. APISTOTELHS summed it up the best in the comments of the API docs. Chess.com's API lacks a bit of query control. Searching through a player's monthly archives could work, but would end up being a lot of requests and searching. Unofficial EndpointI think working off the unofficial endpoint is a great idea, especially if you only need the FEN. I'd assume PGN is generated upon request, and the way chess.com deals with moves is based on how their engine is implemented. So I'm not surprised the PGN isn't included in the unofficial endpoint. Chess.com might have some reservations about using the unofficial endpoint, given that I'm not sure that the unofficial endpoint is blocked for parallel requests. Unsure really and probably best to check with them for this particular lib. Parsing
|
Hey @andyruwruw thanks a lot for taking a look at this issue, I appreciate the thoughtful response and your time as an open source dev. re:
Is this someone in particular, I could ask if you know who?
This is absolutely brilliant, i never would have considered this as a way to encode the moves. If chess.com is using that to encode, then there must be a lookup table they use to do that somewhere. Maybe they can share or I can write a helper library |
I finally figured out how I played a fake game vs. myself and mapped out each square as they are encoded in ASCII. Things were a lot simpler than I thought. Each move is 2 characters (2 bytes). The first character encodes where the piece started. The tables below show the different values of each square. ASCII:
Hex:
Decimal:
Guess I should have just kept things in ASCII all along! Using the string Not quite sure if we'd want to take the move results and convert them to PGN, or leave that up to whoever is using the package. 😄 @jschiarizzi I used to work over there so I send a slack message to my old boss! No reply yet. If either you or @pi0neerpat are interested in writing this endpoint, I'd be happy to merge it in! |
This is flippin sweet! I'll take a look at implementing it and/or funding on gitcoin |
Um. It is NOT an undocumented chess.com API, but an internal tool, also it clearly violates chess.com ToS:
https://www.chess.com/legal/user-agreement Also the callback link gives different result depending whether you are logged in or not. |
Thanks for bringing that up, I'll get it removed |
Disagree with @bmacho but 🤷 |
I'll contact someone inside Chess.com again, try to get a solid answer whether we're okay to use this endpoint. Given that this library is semi-endorsed by Chess.com, I think it'd be best if we're 100% positive we can use this or remove it. |
Heard back from Chess.com. The callbacks we used aren't intended for general use but it looks like we're clear to keep it with a few disclaimers. Chess.com could change the endpoint without notice making it very unstable, unlike the PubAPI. We knew this, but we'll have to periodically check to ensure our function still works as intended. Best to add documentation that this endpoint should NOT be used for anything important or official. If anyone hammers the endpoint with requests, Chess.com will give them an IP ban, so we should place a warning to use it sparingly. He mentioned they don't have a clear statement over fair use ("since we suppose they aren't being used"), so we should add a statement about fair usage. I'll close this when the following action items are taken care of 👍:
|
We're good to go! Thanks for bringing that up @bmacho. 🙂 Changes are live in v1.1.1 |
Yay! https://niftychess.com will live on :D |
Howdy maintainers. Great library you've created here!
I'm wondering how I can add a
getGameByID()
. For example takehttps://www.chess.com/live/game/6508402266
, get the id6508402266
, and fetch the pgn.After searching through the chess.com API docs, it doesn't seem there is an easy way to do this without parsing through the user's history, which is not ideal. Wondering if you have any tips on how to achieve this
I can help make a PR to implement if necessary.
The closest I've gotten is using the (undocumented) api
https://www.chess.com/callback/live/game/6508402266
, but this doesn't return the pgn, and instead some encrypted stringmoveList: "mC0Kgv5QfHQBvBKBHt7MegZRdv6Evw90nDMNtAYQiq!TltXHAiRJCKEmfeTZbl0Fw2Fe2?Z9?..."
Thank you!
The text was updated successfully, but these errors were encountered: