Hi, I’m struggling with the Twitch TV challenge at the moment with regards to getting an error message for accounts that are not valid (Brunofin and comster404) users and links to valid user channels I receive this message({“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}).
What is confusing me is which way to go as lots of pens I have looked do not work either and I am confused by the instruction which ask you to use a predefined array reply but also say to use https://wind-bow.gomix.me/twitch-api request. Other code I look at use "https://api.twitch.tv/kraken so I’m not sure which is correct
The API will return always return data.It will either have all the user’s channel data or let you know that there is a problem with the user channel.
Invalid accounts will give you , {“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}
Check whether the data from the API has an error property, if (data.hasOwnProperty('error')) { // there is an issue with this user's channel } else { // All good. User is offline or online }
Thanks for your reply, I don’t seem to get an error property for Brunofin or any other made up account so all I get returned is that the channel is offline. There is no data to suggest the account is invalid.
Are you making your request to url containing ‘streams’? What happens if you make the request to url containing ‘channels’ instead of streams?
I think this may give you the error that you need in order to confirm the channel does not exist.
@frogo123 Glad to be of help! Let me know if you have any more problems; I finished this project just over a week ago after having spent too much time confused by contradictory advice about how to do it. In the end I just registered for a twitch.tv clientId and used the twitch api directly which worked easily. My app is here.