Simske / pgn-downloader

Tool to download games from a specific user on Lichess.org or chess.com
GNU General Public License v3.0
2 stars 2 forks source link

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:

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

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:

Contributing

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