'Search string to see if it contains '_id' which means there is a live stream.
Dim index As Integer = stringGetInfo.IndexOf("_id")
'If index is greater than 0 then pilot is streaming.
If index < 1 Then
stringTwitchID = ""
End If
End Using
With the new API, this no longer works. I have looked through all the documentation for the new API and I am unable to get anything to work.
How do I determine if a certain Twitch Channel is live?
As the docs show, you have to specify your client id as a header rather than querystring param, and to specify the channel you would use either the user_id or user_login params (up to 100 channels at a time).
If a channel is live, they’ll be shown in the response, if a channel isn’t in the response then they’re offline.
It seems this API is overly complicated for a simple task such as seeing if a particular channel is online or offline which was simple and easy to do with previous API versions.
I will have to research to see how to add a header in a VB.NET WebClient as I am getting a ‘Received an unexpected EOF or 0 bytes from the transport stream’ error message in the code I have tried so far.
Using headers is not overly complicated, it’s a very basic part of making HTTP requests and is dealt with easily with all proper HTTP request libraries. You can even look at the docs, the curl example to use Get Streams is just 2 lines.
The sort of error you’re describing doesn’t sound like anything to do with Twitch, and most likely your code/improper use of the HTTP library you’re using.