kurumkan
kurumkan

Reputation: 2725

twitch.tv api- how to get logo of the streamer who is offline

twitch tv - how to get logo of the streamer who is offline? For instance I can get logo link of the streamer like this(works only if the streamer online):

$(document).ready(function(){   
getChannel("OgamingSC2");
});

 function getChannel(name){
 $.getJSON("https://api.twitch.tv/kraken/streams/"+name+"?callback=?",
 operateResults);
}

function operateResults(data){
console.log(data.stream.channel.logo)//logo   
}

But if the streamer offline:

data.stream

will be equal to null.

So how can I get the logo if the streamer offline?

Upvotes: 0

Views: 624

Answers (1)

Schmoopiie
Schmoopiie

Reputation: 26

Correct, stream will be null if the stream is offline. You can use the channels endpoint to get the logo of the broadcaster.

Upvotes: 1

Related Questions