Get login (username) or display_name with the streams endpoint

I’m playing around with the api, listing games, when a game is clicked I list the streams, but I’m missing the streamers name.

I’m not sure how to approach this, making a request for each one doesn’t seem like a good idea and requesting all users at once means I have to pair the two results some how.

Is it possible to get the login (username) or display_name through the streams endpoint?

Not as far as I know (at least not savely). The only thing definitely related to the user behind a stream is the given user_id.
You can collect those from your first request and create a second one using the users endpoint with id=firstId&id=secondId etc.

What you can try as well eventhough I don’t know how safe that is (regarding the correctness of the outcome) would be to read the thumbnail_url field which ends in the following (at least in the examples and a test request I made):

live_user_<USERNAME>-{width}x{height}.jpg

parsing this with something like .split(/[_-]/)[2] should get you the login of the user.

Again though I don’t know whether that will always stay like that nor whether that will always be kept in that format.

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