Answers.Body: <p>Lichess has an API which can also be used to download games. For example:</p>
  <pre><code>https://lichess.org/api/games/user/{username}?max=3&amp;color=white
  </code></pre>
  <p>This will download 3 most recent games played by <code>{username}</code> with the white pieces.</p>
  <p>You can find the docs for this operation (and others) here:</p>
  <p><a href="https://lichess.org/api#operation/apiGamesUser" rel="noreferrer">https://lichess.org/api#operation/apiGamesUser</a></p>
  <p>The introduction page lists some clients including one for Python:</p>
  <p><a href="https://lichess.org/api#section/Introduction" rel="noreferrer">https://lichess.org/api#section/Introduction</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-30T15:31:30.843Z
Answers.Text: Thanks - I'm aware of this but as python is not my thing (I do compiled languages, mainly Fortran and C, on big supercomputers) I was hoping somebody skilled in it had done this already
Answers.UserDisplayName: Ian Bush
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-30T15:36:24.853Z
Answers.Text: You can use any language to download a PGN via the web API. I only mentioned Python, because you mentioned it yourself in your question. Even using wget in a bash script should be possible.
Answers.UserDisplayName: Sleafar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-30T15:02:02.997Z
Answers.LastActivityDate: 2020-10-30T15:02:02.997Z
Answers.UserDisplayName: Sleafar
Body: <p>I'd like to be able to automate downloading specific games that have been played on Lichess. Is there any software available that, if given useful information such as the Lichess usernames, colours, time control and (approximate) time of the game will download the game in pgn format? Command line please - ideally it will also flag an error if it fails to find exactly one match.</p>
  <p>I'm running Linux, but as I expect anything that might exist will be in something like python I don't think that is a big issue.</p>
  
Tags: <software><lichess>
Title: Downloading Games From Lichess
ThreadText: # Downloading Games From Lichess
  
  (Asked by: username_0 on 2020-10-30)
  
  I'd like to be able to automate downloading specific games that have been played on Lichess. Is there any software available that, if given useful information such as the Lichess usernames, colours, time control and (approximate) time of the game will download the game in pgn format? Command line please - ideally it will also flag an error if it fails to find exactly one match.
  
  I'm running Linux, but as I expect anything that might exist will be in something like python I don't think that is a big issue.
  
  **Tags:** software, lichess
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-30. Score: 15 | Accepted answer
  
  Lichess has an API which can also be used to download games. For example:
  
  ```
  https://lichess.org/api/games/user/{username}?max=3&color=white
  
  ```
  
  This will download 3 most recent games played by `{username}` with the white pieces.
  
  You can find the docs for this operation (and others) here:
  
  <https://lichess.org/api#operation/apiGamesUser>
  
  The introduction page lists some clients including one for Python:
  
  <https://lichess.org/api#section/Introduction>
  
  > **Comments:**
  > **username_0**: Thanks - I'm aware of this but as python is not my thing (I do compiled languages, mainly Fortran and C, on big supercomputers) I was hoping somebody skilled in it had done this already  
  > **username_1**: You can use any language to download a PGN via the web API. I only mentioned Python, because you mentioned it yourself in your question. Even using wget in a bash script should be possible.  
  
  ---
  
  