Skip to content
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

Adds downloading user games from Chess.com and cleans up downloading user games from Lichess.org #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pywz
Copy link

@pywz pywz commented May 6, 2022

The following changes have been implemented in this PR:

  1. Added ability to download all games from a Chess.com user
  2. Cleaned up the functionality of downloading games from a Lichess user by using the lichess Python package
  3. Deleted .DS_Store since it is unnecessary and already not included in .gitignore
  4. Added to README.md on how to download user game data for Lichess or Chess.com and improved its readability

Comment on lines 1 to +4
colorama==0.4.4
chess==1.5.0
requests==2.20.0
lichess>=0.1.9
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a problem installing this and had to change it to:

Suggested change
colorama==0.4.4
chess==1.5.0
requests==2.20.0
lichess>=0.1.9
colorama==0.4.4
chess==1.5.0
requests==2.27.1
lichess>=0.1.9

This was the error

ERROR: Cannot install -r requirements.txt (line 4) and requests==2.20.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested requests==2.20.0
    lichess 0.1.9 depends on requests==2.27.1

archive_dates[len(archive_dates) - 1] = archive_dates[
len(archive_dates) - 1].rstrip("\"]}")

with open("games.pgn", "w") as new_file:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will need the max param also for chess.com
One way to do it is use parse the json from https://api.chess.com/pub/player/hikaru/games/2017/04 to count the number of games. and get the pgn with .pgn


archives = http_response.read().decode("utf-8")
archives = archives.replace("{\"archives\":[\"", "\",\"")
archive_dates = archives.split("\",\"" + url_chessdotcom)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better if the dates are sorted from recent to older. So you can always download the latest games by default.

Copy link
Owner

@vitogit vitogit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanderbilt-cs This pr is great I left some comments to make it better.. Thanks for the pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants