Error message on the Twitch.tv project

Hello Guys, I’m working on the Twitch.tv project, I can’t get the names, if I console.log to test it says: “The parameter ‘name’ was malformed: the value must match the regular expression /^[a-zA-Z0-9][a-zA-Z0-9_]*$/”.

Did anyone else have this problem?
You can find the code here: http://codepen.io/giulippi/pen/bgLyVR?editors=0002

Thank you for any advice, I’m getting crazy and I can’t continue with the other parts if I don’t fix this.

I just finished that one. Use the API that’s suggested in #10 on the challenge page. Here’s a link https://wind-bow.gomix.me/

Sorry just waking up. Looking a little more closely now @.@

This line:

`var onlineURL= "https://wind-bow.gomix.me/twitch-api/streams/:stream" + following[i];`

The “:stream” as noted in the API documentation needs to be replaced with the actual stream name. For example

"https://wind-bow.gomix.me/twitch-api/streams/freecodecamp"

1 Like

URL segments that start with : are known as route parameters and should be substituted by a specific value when making requests as shown by @cnova00

1 Like

When I paste that link into a browser url I’m getting an error message that the site might be temporarily down or have moved permanently to a new address, I get the same error message in my console when I try to use the link in codepen - not sure what I’m doing wrong?

Guys I reviewed a lot of time my code and all the urls, I think that the problem is in this line:

for (var i=0 ; i<following.length; i++) {
var url2=“https://wind-bow.gomix.me/twitch-api/streams/freecodecamp/” + following[i] + “/?callback=?”;

I really don’t know how to fix it, I am completely stuck.

  1. you don’t need to add callback=? at the end, since provided api supports CORS

  2. your code sends requests to invalid api endpoints

valid routes:

for /users/:user => 'https://wind-bow.gomix.me/twitch-api/users/' + name
for /channels/:channel => 'https://wind-bow.gomix.me/twitch-api/channels/' + name
for /streams/:stream => 'https://wind-bow.gomix.me/twitch-api/streams/' + name

where name is one of ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]

Why don’t you play with the api for some time to understand it before you start coding?

Here’s a nice tool for api testing: postman

Thank you so much! Actually I didn’t have problems with the previous challenges but I need to do some practice for sure.

Thank you again for your help!