Here is an example. The image is a screenshot of how they look in our database at the moment. Take a look at their Twitch page. First off, the haven’t ever streamed (so why does it say they were playing HearthStone). They have 0 views, and 0 followers…
The viewers, followers and views are all taken directly from the Twitch API and stored in our database. So the numbers shown are a direct result of what Twitch’s API has returned (or so I’m guessing, since there is nothing in between the API call and the database save).
Again, this only started happening 2 days ago. I’ve had this happen to about 20 different streams so far, and I can’t find anything linking them to each other (a reason as to why this is happening). Not all streams are like this, just a few random ones.
All of those streams have the same views & followers data? That seems suspiciously like a bug in your application code. Is it open source so I can take a peek?
I haven’t seen any indication that our API is reporting terribly wrong numbers on a consistent basis. Occassionally we’ll have blips where we report 0 views/followers, or serve stale data, but that’s very rare and shouldn’t be happening on such a widespread basis.
You currently have a few streams marked as “live” on your site that aren’t live. All of their data matches the current top stream - Riotgames. This, plus the code you shared, makes me think that in some cases $stream_info['name'] is blank, causing your query to our API to return not one stream object, but all available streams. Then you blindly grab the top stream and run your update query that blindly the database… potentially hitting every row since you don’t escape your variables?
If I had unredacted code I could MAYBE try to guess at the bug, but I’ve very confident that the issue is either in how you’re calling our API, how you’re updating the database, or both. Possible values of $stream_info['name'] would also help.
Dug deeper into this, and it looks like this could be related to instances where the API is not returning a followers and views property on the channel. Is this intended behavior? Under what conditions does the API omit that data?
"bio": "Afflicted Studios has been streaming for over 4 years. The original channel (AfflictedStudios) was established in 2009 at Justin.tv. The channel is slowly growing and maintaining loyal fans. Thank you all for your support!",
*Looks like a user is being returned instead of a channel. The incorrect values seem to be a side effect of me not properly accounting for the missing values. Maybe you are having the same issue @ManaPot
I can report the same issue as stream object is sometimes missing some values or . for our software to work properly we then have to make a new API call to get the correct data which should be a problem for future rate limits.
This is a bug that I have already reported. The problem you are experiencing is that the user object is being returned instead of the channel object for the channel requested. Unfortunately this appears to be a caching bug, and as far as I’m aware there’s underlying technical challenges which prevent its immediate possibility of being fixed.