try {
var apiPath;
if(getStreamInfo){
apiPath = "/kraken/streams/" + twitchChannel.name.trim();
}else{
apiPath = "/kraken/channels/" + twitchChannel.name.trim();
}
opt = {
host: "api.twitch.tv",
path: apiPath,
headers: {
"Client-ID": twitchClientID,
Accept: "application/vnd.twitchtv.v3+json"
}
};
}
catch(err){
print(err);
return;
}
You have to swap the header for the v5 header and swap the apiPath to use the UserID of the channel instead of the UserName of the channel
You may consider switching over to Webhooks instead