Selecting streams to show on embed


I have been working on implementing embedded twitch streams from a specific list on my website. The overall concept im working towards is: Embedding a twitch player, if person A is live - embed person A, if person A & person B is online - randomize which loads for the visitor of the website.

Some questions regarding this;

When i get the oAuth token from the token call, how long does it last before expiring? (cause right now im calling a new token everytime i check live status)

Currently i get the token through php, and can see if the stream is online or offline, would it be possible to code this entire thing in Javascript? Since PHP is not my strong suit.

The expiry is sent along with the payload that you got the token in.

You can also call the validate endpoint to check the current status and the expiry of the token

Sure do it in Brainfuck if you want, any language that can make HTTP calls and process the string response can be used to call an API