You’re not trying to get the streams with the channel ID, you’re getting them with the channel name.
Try changing var name = twitchData.channels[i].name; to var id = twitchData.channels[i]._id; and then in the request URL change + name to + id