cyanfish / python-lichess

Python client for the lichess.org API
GNU General Public License v3.0
53 stars 13 forks source link

Problem with getting pgns #15

Closed JakubZelek closed 2 years ago

JakubZelek commented 3 years ago

Sometimes games start with middle game when user try get pgn. For example:

games = lichess.api.user_games('Tthrot', max=605, perfType='bullet')
for i in range(600):
  if i > 58 and i < 63:
    print(i, next(games)['moves'])
  next(games)

have returned

59 dxc4 Qxc4 Bg7 Qd3 O-O e4 Nbd7 Nf3 c5 d5 a6 Be2 Qc7 O-O Ng4 h3 Nde5 Nxe5 Nxe5 Qg3 Qb6 Bf4 Nd7 Rab1 Qb4 a3 Qd4 Be3 Qe5 f4 Qc7 e5 Nb6 Rbd1 Bf5 d6 exd6 exd6 Qd7 Bg4 Rfe8 Bxf5 Qxf5 Rfe1 Nc4 Bf2 Rxe1+ Rxe1 Nxd6 Ne2 Nc4 Kh2 Qc2 Ng1
60 dxc4 Qxc4 Bg7 Nf3 Be6 Qd3 Bd7 e4 O-O Be2 Ne8 Be3 e6 Rc1 f6 O-O e5 d5 c6 Rfd1 cxd5 Nxd5 Be6 Qb5 a6 Qxb7 Nd7 Nc7 Nxc7 Rxc7 Rc8 Rcxd7 Bxd7 Qxd7 Qe8 Qd5+ Qf7 Bxa6 Qxd5 exd5 Rce8 Bc4 Kh8 d6 Rd8 Bc5 Rf7 Bxf7 Rf8 d7 Rd8 Be8 Kg8 Be7 Ra8 d8=Q Rxd8 Rxd8 Bf8 Bd7 Kg7 Rxf8 Kh6 Bxf6 g5 Be8 g4 Bg5+ Kg7 Rf7+ Kg8 Nxe5 Kh8 Bf6+ Kg8
61 Bg7 cxd5 Nbd7 Nf3 O-O e4 Nb6 Bc4 Bg4 a4 Bxf3 gxf3 c6 dxc6 bxc6 Be3 Rb8 Qa2 Nxc4 Qxc4 Rxb2 a5 Nh5 Rb1 Qxa5 Rxb2 e5 O-O exd4 Bxd4 Qg5+ Kh1 Qf4 Qd3 Bxd4 Qxd4 Qxf3+ Kg1 Qg4+ Kh1 Qf3+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