Get videos and live streams

When you get videos the first item will also be the live stream if the user is currently streaming, but the “thumbnail_url” field is just an empty string.

I wasn’t sure how to handle this entry. Ideally, I would like to show information about the live stream, but it looks like the only way to do that is through a separate call.

Sounds like you just need to call “get streams” and see if they are streaming before calling get videos?

Concieveable, however, you could parse the duration and created_at times from the first video and see if created_at + duration = now give or take 30 minutes.

Usually created_at + duration = now is only about 5 minutes behind “now”

twitch api get 'videos?user_id=26610234&first=1'
  "data": [
      "created_at": "2022-02-09T23:23:54Z",
      "description": "",
      "duration": "1h5m46s",
      "id": "1292893548",
      "language": "en",
      "muted_segments": null,
      "published_at": "2022-02-09T23:23:54Z",
      "stream_id": "39437613033",
      "thumbnail_url": "",
      "title": "[!Drops ON] Lost Ark (Ladon / Artillerist)! \\o/ #Ad - !Merch in 2 days! - #EpicPartner Creator Code: COHH - - !PC",
      "type": "archive",
      "url": "",
      "user_id": "26610234",
      "user_login": "cohhcarnage",
      "user_name": "CohhCarnage",
      "view_count": 99,
      "viewable": "public"
  "pagination": {
    "cursor": "eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MX19"

23:23:57 + 1:05:46 = 00:29:43 (give or take quick maff) the current time is 00:30:00 ish

Or just assume that a video with no thumbnail is being “recorded”/is the active stream.

The stream_id should also be the stream ID returned from get streams.

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