Skip to content

Instantly share code, notes, and snippets.

@zzstoatzz
Last active June 8, 2023 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzstoatzz/be298d88bc99b68d8056ab8c13a5f25d to your computer and use it in GitHub Desktop.
Save zzstoatzz/be298d88bc99b68d8056ab8c13a5f25d to your computer and use it in GitHub Desktop.
@flow(name="Store chess.com users' games", version="1.0.0")
def orca(filepath: str) -> None:
logger = get_run_logger()
for username in ['n80n8']:
logger.info(f"Checking for games on chess.com from: {username}")
# list of URLs to GET months of games from
archive_urls = get_player_game_archives(username=username).archives
new_user_games = [get_games(url) for url in archive_urls]
if len(new_user_games) == 0:
logger.info(f'No new months of games to load for {username}!')
continue
logger.info(f'Fetching {len(new_user_games) } new months of games from {username}..')
for month in new_user_games:
load_games(
games=month,
base_path=filepath
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment