Skip to main content

Tool to download games from a specific user on Lichess.org or chess.com

Project description

pgn-downloader

pgn-downloader is a CLI tool to download chess games from Lichess or chess.com.

It provides filters to specify playing color, date range and playing mode.

Installation

pgn-downloader requires Python >=3.6.

It can then installed with pip:

pip install --upgrade pgn-downloader

With this the tool can started with either:

pgn-downloader server username
python -m pgn_downloader server username

Usage

usage: pgn-downloader [-h] [-c {white,black}] [--since SINCE] [--until UNTIL] [--mode MODE] [-o OUTPUT] [--version] {chess.com,lichess} username

positional arguments:
  {chess.com,lichess}   Server to download games from
  username              Username on chosen server

optional arguments:
  -h, --help            show this help message and exit
  -c {white,black}, --color {white,black}
                        Color (white/black) (default: both)
  --since SINCE         Download games since (default: account creation)
  --until UNTIL         Download games until (default: now)
  --mode MODE           Game mode which will be downloaded. Comma separated list (default: blitz,rapid,classical,correspondence)
  -o OUTPUT, --output OUTPUT
                        Output filename (default: server_username-color.pgn)
  --version             show program's version number and exit

Games can be downloaded from either chess.com or lichess.org. If desired the download can be restricted to a certain color, time control and date range.

The time control is specified as a comma-seperated list, with the default blitz,rapid,classical,correspondence. The possible values are:

  • for Lichess: ultraBullet, bullet, blitz, rapid, classical, correspondence, chess960, crazyhouse, antichess, atomic, horde, kingOfTheHill, racingKings, threeCheck
  • for chess.com: correspondence, rapid, blitz, bullet

The date ranges can be selected with the flags --since and --until. They accept either absolute or relative time ranges:

  • absolute: YYYY, YYYY-MM or YYYY-MM-DD
  • relative: number with suffix y for years, m for months, d for days or h for hours.

All dates specified with --since are interpreted as the earliest possible, while --until dates are interpreted as the latest possible (see examples)· All dates are taken in local time.

Examples:

  • absolute:
    • --since 2021: games since Jan 1 2021
    • --since 2019 --until 2020: games between Jan 1 2019 until Dec 31 2020
    • --since 2018-05-04 --until 2019-07 games between May 4 2018 until July 31 2019
  • relative as executed on 2021-06-04 16:30
    • --since 3m: games since Mar 1 2021
    • --since 0d: games from today
    • --since 1d: games since June 3 2021
    • --until 3m: games until Mar 31 2021

Contributing

If you encounter any problems or have suggestions for improvements feel free to open an issue or contact the authors.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgn-downloader-0.2.2.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

pgn_downloader-0.2.2-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file pgn-downloader-0.2.2.tar.gz.

File metadata

  • Download URL: pgn-downloader-0.2.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pgn-downloader-0.2.2.tar.gz
Algorithm Hash digest
SHA256 2253b847ac3c2540d7d861d213a0a04876c5aaf47c43ccf8227c47892e5d76dd
MD5 6d2039c899ed62e9bc78139a554b831d
BLAKE2b-256 0f31645138116c33ccdc2d0ff48b6ec572d13c23679d2e5af217d28c3a7000b6

See more details on using hashes here.

File details

Details for the file pgn_downloader-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pgn_downloader-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a7a77ec310798119c752cdf89f4af3de7d0514f27ca453c6adfd059182a4cb7
MD5 9c968a679be6e7754102108f190a9438
BLAKE2b-256 4bc323539e2cc578874030a2d4b638872a256cd1fb016f61683f33855cc63bf6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page