Twitch API for loop is not logging any data

Twitch API for loop is not logging any data. I do not have channel ID as I donot have an account there. This project is very confusing and their updates and changes makes it even harder

$(document).ready(function(){
  var streams = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];   
  var url= "https://wind-bow.gomix.me/twitch-api/streams/freecodecamp?callback=?";
  $.getJSON(url,function(data){
    if(data.stream === null){
      $("#fccstatus").html("Freecodecamp is Offline");
    } else{
      $("#fccstatus").html("Freecodecamp is Online");      
    }
  });
    var followerUrl = "https://wind-bow.gomix.me/twitch-api/streams/ESL_SC2?callback=?";
  //https://wind-bow.gomix.me/twitch-api/channels/'+person+'?callback=?'
    $.getJSON(followerUrl, function(data2){
     //console.log(data2);
      
  });
  
  for (var i=0; i<streams.length; i++){
     $.ajax({
       type:'GET',
       url:'https://wind-bow.gomix.me/twitch-api/streams/'+ streams[i]+'?callback=?',
       
       success: function(datai){
       console.log(datai);
       }
     })
   }//end of for loop
 
 })

You do not need an account, because the endpoints you are using have their own account registered to FCC. You are basically just borrowing their account. Also, the endpoints you are using are no longer used. Use the following instead. See bullet #9 in the project description.

UPDATE: Due to a change in conditions on API usage explained here Twitch.tv now requires an API key, but we’ve built a workaround. Use https://wind-bow.glitch.me/twitch-api instead of twitch’s API base URL (i.e. https://api.twitch.tv/kraken ) and you’ll still be able to get account information, without needing to sign up for an API key.

https://wind-bow.glitch.me/twitch-api/streams

and

https://wind-bow.glitch.me/twitch-api/channels

and

https://wind-bow.glitch.me/twitch-api/users

@camperextraordinaire Thanks it worked !!

I shortened your title and copied the rest in the body of your post. Please don’t use titles to formulate a multi-sentence question as this takes up a lot of screen space on the thread.
Thanks for your understanding.

1 Like

Sure, thanks for guidance !!