Using online games to plan for your opponent
4NCL – the ultimate forcing function for me to do some study
With the first round of over the board 4NCL just around the corner, I cannot wait to get going. I have grown to love playing in the 4NCL league – games are held at a more Lju-friendly time, in the afternoons and mornings. It makes a stark difference to local league chess when kick-off is around the time I’m thinking about calling it a day, never mind slogging it out for the whole evening. Let’s not forget the ever-present fear of an adjournment …
The other thing that really makes me warm to 4NCL is being forced to prepare. Having never been one for doing any kind of chess study, there is something rather pleasant about finding out who I’m going to be playing against shortly, and using that as an opportunity to learn some interesting lines.
Where are all the games?
One big challenge to this idyllic plan is that as you work yourself down the rating list (you’ll find me somewhere near the bottom, just keep scrolling down), the likelihood of finding games to refer to becomes vanishingly slim. It’s a shame there’s no centralised effort to collect all league and tournament games – you have to record them anyway – but it is completely understandable. Nevertheless, this is not helping the problem at hand.
Those of you who are more inclined to look at games are probably aware of the usual haunts: Chess Results, The Week in Chess and the 4NCL website itself will provide some games to view. I trust, dear reader, you are already familiar with these. But did you know there is a little goldmine of games to explore, thanks in part to the explosion of online chess? Step forward, Lichess!
With many tournaments and leagues heading online, Lichess was one of the most popular online chess sites to facilitate the digitisation of chess events during the pandemic. As well as enabling these events to continue, conveniently we also have records of games. This proved very useful in those online events, and in this blog post I’m going to show you how to get at historical games.
Introducing the Lichess API
What’s an API!? I can almost here some of you utter those words. API stands for Application Programming Interface. It is a piece of software that enables applications to talk to each other, using an agreed language. Everything you use related to technology will have many APIs in play. Don’t worry, you don’t need to know too much about what they do for the purposes of this exercise. Lichess has a large number of APIs available, allowing you to do anything from looking at games currently being played, pull puzzles, tell you who’s online, etc. The particular API we’re interested in is exporting games of a user. This handy little API will allow us to download specific games from a user, over a given time period, in PGN format, ready for us to analyse.
For those of you having palpitations at the thought of doing this, don’t worry. There is another workaround too. Lichess does offer a search option (log in and then Tools -> Advanced Search) to find games, but this will not allow you to download all the games into a PGN format. For those of you without chess database software, it may even be a preferred route.
How to use it
The documentation is fairly straightforward to follow – you should be able to figure out how to tweak the request based on the example below. You will need to be logged into your Lichess account to be able to do this.
Let’s say I want to download the standard time control games (aka classical on Lichess) for a user. All we need to do is run the following request (which looks like a web address) in your favourite browser – don’t forget to replace
Finally, to add more filters, such as date range, etc. you’ll need to add an & and then continue. For example, if I want all X’s games and they are rated, I’d do the following: