#Script to Extract Game IDs

12 messages · Page 1 of 1 (latest)

feral reef
#

I talked to the creator of http://perpetualcheck.com/antichess/lichess.php about how they got the PGN of so many games together. Their reply was that they had made two scripts, one which would extract the target game IDs and another which would give the PGN of those games.

I was curious about how this is possible, so does anybody know how to use the advanced search option and make a script to directly extract the game IDs of all games which come after doing the advanced search of lichess?

solemn vine
feral reef
#

That is too big tbh

#

shouldn't it give the games played by me in the defined timeframe?

bronze swallow
#

lichessorg -> lichess.org ?

lethal pebble
#

clocks=True looks wrong. (Maybe Lichess server accepts it, but I think it isn't according to the specification...)

||A link to the specification of the lichess api can be found at the top of the documentation page (or it can be found herehttps://github.com/lichess-org/api/blob/master/doc/specs/lichess-api.yaml#L1 )
It says it uses openapi 3.1.0.
The data types for openapi 3.1.0 can (almost) be found at https://spec.openapis.org/oas/v3.1.0#data-types,
it refers to a JSON schema specification draft, hence the "(almost)", which can be found at https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-4.2.1 - which shows booleans to be "true" or "false", i.e not "True" 😅 ||

lethal pebble
#

I tried accessing the API using a library, and enabled logging.

I see the library uses "antichess" (not "Antichess") and the library has a beginning "/api/" which you aren't using (maybe both exists, not sure)

Example.java

import java.time.ZonedDateTime;

import chariot.Client;
import chariot.model.Enums.PerfType;

class Example {

    public static void main(String[] args) {

        //var client = Client.basic();

        var client = Client.basic(conf -> conf.logging(l -> l.request().all()));

        var list = client.games().byUserId("cFlour", params -> params
                .clocks()
                .since(ZonedDateTime.now().minusDays(5))
                .until(ZonedDateTime.now())
                .perfType(PerfType.antichess)
                .rated())
            .stream().toList();

        System.out.println("Found " + list.size() + " games!");
    }
}

https://jdk.java.net/19/
https://repo1.maven.org/maven2/io/github/tors42/chariot/0.0.65/chariot-0.0.65.jar

$ ~/prog/java/openjdk/jdk-19.0.2/bin/java -cp ./chariot-0.0.65.jar ./Example.java
Mar 15, 2023 3:09:54 PM chariot.internal.InternalClient request
INFO: ### Request: https://lichess.org/api/games/user/cFlour?clocks=true&rated=true&perfType=antichess&until=1678889394000&since=1678457394000
Headers:
accept: application/x-ndjson
user-agent: Java/19.0.2 chariot/0.0.65
Body:

Mar 15, 2023 3:09:54 PM chariot.internal.InternalClient request
INFO: (GET https://lichess.org/api/games/user/cFlour?clocks=true&rated=true&perfType=antichess&until=1678889394000&since=1678457394000) 200
Found 368 games!
$
bronze swallow
#

uppercase True should work i think even though it's indeed not really the proper way

#

the link works fine for me if i add the dot. seems like uppercase antichess also works. and yeah, the api endpoint is with /api but there's another one without it.