I have been polling some information from the API for awhile, I have noticed that the _id on streams change fairly regularly. When I say fairly regularly, I mean every 30 minutes or so.
Does the _id only change when the streamer goes offline and comes back online or does the _id just change randomly? Also is there any way to poll a stream _id later to get the time that the stream ended? or do you have to continually poll it until the stream _id is no longer visible and then assume that it ended?
I would ideally like to know when a stream began and ended as a single stream, and I figured that the stream _id was the right way to determine this.
The stream _id changes every stream, so if the broadcaster goes offline then online, it’ll change.
As for polling for the stream _id after the stream has ended and API has updated, I don’t believe there is a way as the API returns null at that point.
For my stuff, I just poll to see if the stream token contains anything (_ID, game, etc) - if it contains something, then the stream is live but if it returns null then the stream is offline. If the stream was online but I poll and it shows offline, I consider it a soft-end, and I rely on a second poll few minutes later to ensure it wasn’t an API burp and that stream has actually ended.
In your data do you ever have any where a new stream starts for a streamer before the last stream ends?
I have some things like this:
id twitch_stream_id streamers_id beginning end status
519949 23313803328 19660 2016-10-02 15:06:46 2016-10-02 15:34:49 1
520099 23313950976 19660 2016-10-02 15:27:28 2016-10-02 15:55:17 1
It’s a little odd that a new stream would begin before the previous one ended.
That may just be due to API caching the data, since even after they end the API will say otherwise for several minutes.
I’ve never really monitored it to greater detail so I’m not sure if there is another underlying reason, but API caching would be my first guess.
And not just the API caching data, the fact that when you poll you might get server a, then on the next poll get server b, and server b is still feeding you the previous stream data as it’s not updated yet.
So yes in the event that a stream bounce occurs you will get this weirdness
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.