Getting Twitch channel logo/info when channel is offline

I’m coming along on the Twitch project and figured out the API calls for the most part, however I’m having a hard time getting the logo from Twitch channels that are currently offline. Here is the codepen.

For channels that are currently online I got the logo, followers, etc via the stream object like this:

for(var i = 0; i < streamers.length; i++){
$.getJSON('' + streamers[i] +'?callback=?').done(function(data2) {
    if( != null){
      $('#channelsOnline').prepend("<img src=" + + ">" + "<h3><a href=" + + "</h3><ul><li>" + + " is online now <a/></li><li>followers: " + + "</li><li> viewers: " + + "</li><li> game: " + + "</li>")
    else {
      // Separates name of channel from the rest of the URL
      var channelUrl =;
      var channelName = channelUrl.match(/([^\/]*)\/*$/)[1];

      $('#channelsOffline').prepend("<a href=" + + "><h3>" + channelName + " is offline" + "</h3>")




That accesses the info and logo via the stream object. When the stream object is null I cannot access the logo property. How would I get the logo if the channel is offline and the stream object is null?

I tried doing it with a getJSON call that looks like this but I get a 403 error, meaning that the call is valid but access is denied.

   $.getJSON('' + streamers[i] + 'callback=?').done(function(data3){

Thanks for the heads up on both issues.

I’m attempting to get the logo and other info via the channels endpoint but everything is coming back null. This is what I have:

    for(var j = 0; j < streamers.length; j++) {
     $.getJSON('' + 


The call comes back with all the attributes null or undefined like this :

Any idea what’s wrong?

That’s a good point and that issue is new to me so thanks for pointing it out, but that wasn’t the problem.

I was looping through the for loop with a variable called j but when I passed the streamers array I passed it with an i, streamers[i]. Wrong variable name.