Twitchtv(need help!) please review

Twitchtv(need help!) please review
0

#1

i’m unable to output the names of the offline channels by arr[] or switch.it is just showing undefined


#2

@Ace-ezer,
when running your code I get a 400 status error for making the twitch API calls.
In the project’s page in FCC, there is an update saying to choose a different url to make API calls,

Using the url you chose requires an API key which I am not sure you have signed up for.
Try using the url in the project’s page.

I would highly suggest to look into Twitch’s documentation as well,

https://dev.twitch.tv/docs

Best of luck.


#3

i’ve removed the id on purpose its not the url’s fault. i just didn’t want it to be used by others. Also its not the url’s fault as if the channel is offline it won’t br returning data hence no channel name and that’s where the problem lies because i’m unable to display the offline channel’s name by using array also.


#4

If you comment out:

      headers: {
        "Client-Id": "" //i've removed the client id for now
      },

and use the recommended url:

url: "https://wind-bow.glitch.me/twitch-api/streams/" + arr[i],

then you will get results and not the “error” alert.

BTW - don’t use alerts for debugging purposes, because they are very annoying and require clicking OK for each one. Use console.log statements instead.


#5

Also, since you do not show the id, I can not test to make sure it is not a problem. You might want to double check if the header property should be “Client-Id” or “Client-ID”.


#6

thanks for your reply. i took your suggestion but it is still not working . i am unable to display the offline channel’s name