I cant get the user id by the stream id

What do you mean “through their stream”

if you call https://api.twitch.tv/helix/streams with no other params

It’ll give you the top streams on the platform by view count.

That’ll contain an example payload such as

    {
      "id": "123456789",
      "user_id": "98765",
      "user_login": "sandysanderman",
      "user_name": "SandySanderman",
      "game_id": "494131",
      "game_name": "Little Nightmares",
      "type": "live",
      "title": "hablamos y le damos a Little Nightmares 1",
      "tags": ["Español"],
      "viewer_count": 78365,
      "started_at": "2021-03-10T15:04:21Z",
      "language": "es",
      "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_auronplay-{width}x{height}.jpg",
      "tag_ids": [],
      "is_mature": false
    }

This is a stream from sandysanderman

If you have the username or ID of a user on Twitch then you can do

https://api.twitch.tv/helix/streams?user_id=26610234
or
https://api.twitch.tv/helix/streams?user_login=cohhcarnage

Which will both return

{
  "data": [
    {
      "game_id": "515024",
      "game_name": "Diablo IV",
      "id": "41451793625",
      "is_mature": false,
      "language": "en",
      "started_at": "2023-06-07T11:56:03Z",
      "tag_ids": [],
      "tags": [
        "adhd",
        "moderated",
        "devswelcome",
        "parent",
        "goodvibes",
        "chill",
        "BackseatingWelcome",
        "NoPolitics",
        "NoSpoilers",
        "Variety"
      ],
      "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_cohhcarnage-{width}x{height}.jpg",
      "title": "[!Plushie - LAST DAY!] - Diablo 4 (!Drops \u0026 !GiftSubs) - SGF \u0026 Amnesia later! - !D4Thoughts - !PowerGPU / !MobileApp",
      "type": "live",
      "user_id": "26610234",
      "user_login": "cohhcarnage",
      "user_name": "CohhCarnage",
      "viewer_count": 14439
    }
  ]
}
1 Like