URL for live stream from helix API data

What is the proper way to get the URL for a live stream after getting the data from https://api.twitch.tv/helix/streams

You can make a second request to to /users to look up the channel name or used https://twitch.tv/streams/:stream.id/channel/:stream.user_id to link to the stream page. Not sure if the second method is documented anywhere though.

Thanks Andrew! Great info on the second method.

I was doing the following by grabbing the username from the thumbnail_url and appending it to twitch.tv but your method seems more legit.

//entry is a single object returned from the /helix/streams API
begin = entry.thumbnail_url.indexOf('live_user_') + 10; //10 is the length of 'live_user_'
end = entry.thumbnail_url.lastIndexOf('-\{width\}');
username = entry.thumbnail_url.slice(begin, end);
url = 'https://www.twitch.tv/' + username;

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.