Skip to main content

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.

Metadata

Release files for pgn-downloader 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgn-downloader 0.2.2
File Size Uploaded Provenance
pgn-downloader-0.2.2.tar.gz 20.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pgn-downloader 0.2.2
File Interpreter ABI Platform
pgn_downloader-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 41.0 kB

Release files / pgn-downloader-0.2.2.tar.gz

Download URL pgn-downloader-0.2.2.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2253b847ac3c2540d7d861d213a0a04876c5aaf47c43ccf8227c47892e5d76dd
BLAKE2b-256 checksum
How to use checksums
0f31645138116c33ccdc2d0ff48b6ec572d13c23679d2e5af217d28c3a7000b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / pgn_downloader-0.2.2-py3-none-any.whl

Download URL pgn_downloader-0.2.2-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a7a77ec310798119c752cdf89f4af3de7d0514f27ca453c6adfd059182a4cb7
BLAKE2b-256 checksum
How to use checksums
4bc323539e2cc578874030a2d4b638872a256cd1fb016f61683f33855cc63bf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for pgn-downloader 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page