Search code examples
videotwitch

Twitch get videos for a user


For an application, I need to get a list of videos/streams posted by a user. I have read through the twitch.tv API (https://github.com/justintv/Twitch-API) but I am unable to find anything. All I can find is how to obtain a list of videos/streams that a user has subscribed to.

Can someone please help me to obtain the list of videos posted by a user?

Thanks!


Solution

  • I'm not sure if you are talking about twitch highlights or past broadcasts. If you are looking for highlights, you can get those from:

    https://api.twitch.tv/kraken/channels/USERNAME/videos?limit=10
    

    The limit can be changed to get as many as you need. The results are returned as a JSON and look like this:

    {
    "_total": 179,
    "videos": [
    {
      "title": "Twitch Weekly - February 6, 2015",
      "description": "Twitch Weekly LIVE on February 6, 2015!",
      "broadcast_id": 13019796368,
      "status": "recorded",
      "tag_list": "",
      "_id": "c6055863",
      "recorded_at": "2015-02-06T21:01:09Z",
      "game": null,
      "length": 4015,
      "preview": "http://static-cdn.jtvnw.net/jtv.thumbs/archive-621292653-320x240.jpg",
      "url": "http://www.twitch.tv/twitch/c/6055863",
      "views": 318,
      "broadcast_type": "highlight",
      "_links": {
        "self": "https://api.twitch.tv/kraken/videos/c6055863",
        "channel": "https://api.twitch.tv/kraken/channels/twitch"
      },
      "channel": {
        "name": "twitch",
        "display_name": "Twitch"
      }
    },
    ...
    ],
    "_links": {
    "self": "https://api.twitch.tv/kraken/channels/twitch/videos?limit=10&offset=0",
    "next": "https://api.twitch.tv/kraken/channels/twitch/videos?limit=10&offset=10"
    }
    }
    

    If your would like the past broadcasts for a video, you can get those from:

    https://api.twitch.tv/kraken/channels/USERNAME/videos?broadcasts=true
    

    They are also returned as a JSON and look similar to this:

    "videos": [
    {
    "title": "BlizzCon Pre-Show Powered by T-Mobile",
    "description": null,
    "broadcast_id": 17504505664,
    "status": "recorded",
    "tag_list": "",
    "_id": "v24147264",
    "recorded_at": "2015-11-05T20:10:56Z",
    "game": "Gaming Talk Shows",
    "length": 4276,
    "delete_at": null,
    "is_muted": false,
    "preview": "http://static cdn.jtvnw.net/v1/AUTH_system/vods_6d3c/twitch_17504505664_342107744/thumb/thumb0-320x240.jpg",
    "url": "http://www.twitch.tv/twitch/v/24147264",
    "views": 150,
    "fps": {
    "audio_only": 0,
    "medium": 30.0000584614125,
    "mobile": 19.9816431164609,
    "high": 30.0000584614125,
    "low": 30.0000584614125,
    "chunked": 59.9998830771748
    },
    "resolutions": {
    "medium": "852x480",
    "mobile": "400x226",
    "high": "1280x720",
    "low": "640x360",
    "chunked": "1280x720"
    },
    "broadcast_type": "archive",
    "created_at": "2015-11-05T20:11:19Z",
    "_links": {
    "self": "https://api.twitch.tv/kraken/videos/v24147264",
    "channel": "https://api.twitch.tv/kraken/channels/twitch"
    },
    "channel": {
    "name": "twitch",
    "display_name": "Twitch"
    }
    }