Twitch tv getJson question

Twitch tv getJson question
0.0 0

#1

Hello everyone~
I had been stuck with this twich TV project for a long time and since then I kind of gave up for few months and just come back two weeks ago trying to finish it.

I am trying to do the twitch project now and I have a small question regarding the code I saw from some people.

var channels = [“freecodecamp”,“test_channel”,“ESL_SC2”];

function getChannelInfo() {
channels.forEach(function(channel) {
function makeURL(type, name) {
return ‘https://wind-bow.gomix.me/twitch-api/’ + type + ‘/’ + name + ‘?callback=?’;
};
$.getJSON(makeURL(“streams”, channel), function(data) {
var game,
status;
if (data.stream === null) {
game = “Offline”;
status = “offline”;
} else if (data.stream === undefined) {
game = “Account Closed”;
status = “offline”;
} else {
game = data.stream.game;
status = “online”;
};
$.getJSON(makeURL(“channels”, channel), function(data) {
var logo = data.logo != null ? data.logo : “https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F”,

My question is that is the ‘streams’ from this code '$.getJSON(makeURL(“streams”, channel), function(data) {}'
just a random name? It can be any name you want??
and does the “channels” of this second getJson ‘$.getJSON(makeURL(“channels”, channel), function(data) {}’ means the var channels = [“freecodecamp”,“test_channel”,“ESL_SC2”];???
If so, where is the “streams” of first getJson from??

Thanks in advance!


#2

https://dev.twitch.tv/docs/v5/reference/streams