alright so as the title states, im not getting anything returned when im calling twitch streams, even when i paste the url into a different browser, nothing… getting really frustrated
$(document).ready(function() {
var name = [“ESL_SC2”, “OgamingSC2”, “cretetion”, “freecodecamp”, “storbeck”, “habathcx”, “RobotCaleb”, “noobs2ninjas”]
$.getJSON("https://api.twitch.tv/kraken/streams/freecodecamp?callback=?"
)
.done(update)
function update(data){
$("#body").html((data.stream.channel.url));
}
});
and the weirdest thing is this was working a couple of days ago… its really giving me a headache.
https://api.twitch.tv/kraken/streams/freecodecamp?callback=?
returns nothing when pasted on a different tab… AHH!!! please help!
Hey, it does work, but you try to acces data.stream.channel.url, but this property is only set when the channel is streaming. Tip: always check the console for error messages.
that was working a few days ago, it was returning the users url…
and when i copy paste https://api.twitch.tv/kraken/streams/freecodecamp?callback=?
onto a different tab nothing comes out…
so i cant see the object tree anymore
If you try it in a browser, remove the “callback=?” part.
i get this error
Failed to load resource: the server responded with a status of 400 (Bad Request)
when i try it on a different tab
if i remove the callback=? part its pretty much useless i just get the self and channel link
and if you look at the example pen
they use the same api call im using, and when you try to copy paste that one onto a browser it doesnt work either lol
this is so confusing
Yeah, that’s the idea. If the channel isn’t streaming it will return only self and channel.
Try this in your browser: https://api.twitch.tv/kraken/streams/esl_sc2
He/she is streaming now.
1 Like
the thing is, when you replace with a live streaming one such as
https://api.twitch.tv/kraken/streams/ESL_SC2?callback=?
nothing happens either
whoa that worked!
wait i think im messsing up on the names, are they all supposed to be lower case?
Seems like it isn’t case sensitive.
Nope doesn’t matter.
This won’t help solve your current problem, but here’s as an FYI that can prevent future problems, you are going to need a clientID to make API calls in the near future.
thats so weird ! a while ago i wasnt getting anything… does that mean they barely started streaming?
@PortableStick
isnt that only for certain websites though?
is there a page i can see to learn how to set up the client id? haha sorry im a noob
Yup! The very link I just posted has instructions on how to get the ClientID from Twitch.
1 Like
Thanks guys!!! really appreciate your time and patience