Getting notified when a stream is live

I am currently making a site to promote esport professional streams and I am trying to figure out how to check if a channel is live and display it next to the hyperlink for the stream, this is the site currently and I will be needing to add that “check” for ~200-300 streams for the LoL tab Any advice on has to how I should do this?

Use the following API endpoint (at least in v5):

You can query 100 channels at a time, so break your list up accordingly. Remember that it is 2-3 minutes behind when streams actually go live as it is cached data. Do not constantly poll the endpoint though, put a pause between each query.

If wanting to use the New Twitch API:

Again, limited to 100 channels at a time. Rate limits are enforced here so be sure that you are following the rate limit guidelines depending upon the type of authentication you are using.

1 Like

100 channels per page or could I set it to do 100 more channels after that?

You can scan 100 at a time. You would just need to break your master list of channels, be it 100, 200, 350, 512, … channels into lists of 100 and then perform a query for each list. Build up a master list of the data that comes back and refresh your page from that. You could even refresh in between queries if you wanted. However you are designing your solution.

1 Like

Think of the code like this (quick and dirty):

ChannelIndex = 0
FOR ListOfChannels
    FOR 1...100
        QueryListOfChannels += ListOfChannels[ChannelIndex++]
    responseData = QueryTwitch(QueryListOfChannels)
    DELETE QueryListOfChannels

There are probably better ways to accomplish this, this is just off the top of my head.

1 Like

I appreciate the help, I have no experience in web dev outside of what I have learned this week making the site, so all of this really helps!

1 Like

I added you on discord to discuss

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.