Trouble with using the twitchTV API from free code camp

Trouble with using the twitchTV API from free code camp
0

#1

I’m trying to use ‘https://wind-bow.gomix.me/twitch-api’ from free code camp and I’ve been getting an error. It says when I use this URL I won’t have to sign up for an API key or a client ID.


Using the Twitch API
#2

Can you post your code, preferably in CodePen?


#3

I’m having trouble with posting up offline users. The YouTube video is confusing to me. Here is my link: https://ncampbell89.github.io/portfolio/twitchTV.html


#4

I’ve merged your topics to keep things cleaner. Could you please post a link to your code rather than just your project?


#5

Go to View Source or Inspect Element


#6

I’ve been working on the Twitch project yesterday. I’ve had users displayed, but today all of a sudden nothing is there. It keeps giving me ‘No Access Allow Control Origin’. I’ve tried to enable that using the CORS chrome extension and I still keep having the same problem.


#7

Make sure you are using the ‘https’ not ‘http’ source as reference url.


#8

I am using that and nothing works. Here’s what I did:

 $(document).ready(function() {
	// var following = [];
	// Stream info and status api call
	$.ajax({
		type: 'GET',
		url: "https://wind-bow.glitch.me/twitch-api/streams/freecodecamp",
		headers: {
			'Client-ID': 'bmp0kueel807e0fcd29o7sfuszyi7d'
		},
		success: function(data1) {
			if (data1.stream === null) {
				$("#status").html("Free Code Camp is currently OFFLINE.");
			} else {
				$("#status").html("Free Code Camp is currently LIVE.");
			}
		}
	});

	$.ajax({
		type: 'GET',
		url: "https://wind-bow.glitch.me/twitch-api/users/freecodecamp/follows/channels",
		headers: {
			'Client-ID': 'bmp0kueel807e0fcd29o7sfuszyi7d'
		},
		success: function(data2) {
			for (var i = 0; i < data2.follows.length; i++) {
				//gets display name
				var name = data2.follows[i].channel.display_name;
				var logo = data2.follows[i].channel.logo;
				var status = data2.follows[i].channel.status;
				var link = "https://www.twitch.tv/"+name;

				if (logo == null) {
					logo = "images/do_not.png";
				}

				$("#followerInfo").prepend("<div class='row'>" + "<div class='col-md-4'>" +
					"<a href='"+link+"'>"+ "<img src='"+logo+"' width='70' height='70'>" + "</a>" +
					"</div>" + "<div class='col-md-4'>" + name + "</div>" + "<div class='col-md-4'>" + status +
					"</div></div>" + "<br>");
			}
		}
	});

	var deletedFollowers = ['brunofin', 'comster404'];
	for (var i = 0; i < deletedFollowers.length; i++) {
		$.ajax({
			type: 'GET',
			url: 'https://wind-bow.glitch.me/twitch-api/streams/'+deletedFollowers[i],
			header: {
				'Client-ID': 'bmp0kueel807e0fcd29o7sfuszyi7d'
			},
			error: function(data3) {
				var logo = "images/do_not.png";
				var name = data3.statusText;
				var status = data3.status;
				var link = "https://www.twitch.tv/"+name;

				$("#followerInfo").prepend("<div class='row'>" + "<div class='col-md-4'>" +
					"<a href='"+link+"'>"+ "<img src='"+logo+"' width='70' height='70'>" + "</a>" +
					"</div>" + "<div class='col-md-4'>" + name + "</div>" + "<div class='col-md-4'>" + status +
					"</div></div>" + "<br>");
			}
		});
	}

});

#9

I know how to view code in the browser, but please don’t expect people to dig if you want their help. You’ve already posted your code in another thread, so I’ve merged that one here as well. Please keep any further questions you have about using the Twitch API in this thread, but feel free to create another if you run into a completely different problem.

I don’t think there’s anything in your code that is causing you problems. The proxy API at wind-bow.glitch.me probably has a rate limiter on it to prevent abuse. Just try again in a few hours. Perhaps start on another project in the meantime.