lichess-org / api

Lichess API documentation and examples
https://lichess.org/api
GNU Affero General Public License v3.0
428 stars 142 forks source link

trying to broadcast tournament #179

Closed eduardoworrel closed 2 years ago

eduardoworrel commented 2 years ago

hello nobles

I'm trying to create an application that follows Brazilian players in live tournaments.

After failing miserably to use the endpoint https://lichess.org/api/stream/broadcast/round/{broadcastRoundId}.pgn receiving status 200 but without response body, I decided to go down an alternative path that met my needs provisionally.

I share with you in the hope of solving my problem (show the players' clock) or being guided in the best way to do

After days of frustration I saw this graceful endpoint https://lichess.org/study/k2iftQci/multi-board?page=1&playing=false

That's almost all I need, the FEN and player name&rating, but player time and clock are left out

As the endpoint is restricted I used the following resources

simple web scraping https://github.com/eduardoworrel/colabbox/blob/master/web/steal-fen-from-lichess-website/index.ts

websocket to omit client call https://github.com/eduardoworrel/colabbox/blob/master/web/background-update-fen-websocket%20/app.py

Then... I'm crazy? is there a happy path?

if not, is it possible to provide something similar?

Simple as a set of FENs, but with some milestone of the player's clock and which player is pending

ornicar commented 2 years ago

Use https://lichess.org/api#operation/broadcastStreamRoundPgn, it's the only correct way.

See it working: curl https://lichess.org/api/stream/broadcast/round/k2iftQci.pgn. See how it receives new updates on moves immediately within the same single request.

eduardoworrel commented 2 years ago

"See how it receives new updates on moves immediately within the same single request"

where can i find an example? @ornicar

ornicar commented 2 years ago

I just gave you one:

curl https://lichess.org/api/stream/broadcast/round/k2iftQci.pgn