Docs menu

Twitch user videos

Beta GET /v1/twitch/user/videos

GET /v1/twitch/user/videos

A channel's videos (up to 100): id, title, views, game, duration and thumbnails.

  • Cost: 1 credit
  • Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
handlestringyesUsername, with or without the leading @. Also accepted as username.
typestringnoKind of video. One of highlight, archive, upload. Also accepted as filter_by, filter. Also accepted values: HIGHLIGHT for highlight, ARCHIVE for archive, UPLOAD for upload.
sortstringnoOrder of results. Changing it restarts the cursor chain. One of time, views. Also accepted as sort_by, sortBy, order. Also accepted values: TIME for time, VIEWS for views.
limitintegernoHow many videos to return, up to 100 (Twitch allows no paging past the first 100 without a browser session, so the response has no cursor). Range 1 to 100.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

curl
curl -G "https://api.socialscrape.io/v1/twitch/user/videos" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "handle=shroud" \
  --data-urlencode "type=highlight" \
  --data-urlencode "sort=views" \
  --data-urlencode "limit=10"
Python
import os
import requests

params = {
    "handle": "shroud",
    "type": "highlight",
    "sort": "views",
    "limit": "10",
}
res = requests.get(
    "https://api.socialscrape.io/v1/twitch/user/videos",
    headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
    params=params,
)
body = res.json()

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/twitch/user/videos");
url.search = new URLSearchParams({
  "handle": "shroud",
  "type": "highlight",
  "sort": "views",
  "limit": "10"
}).toString();
const res = await fetch(url, {
  headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();

if (body.ok) {
  console.log(body.data);
} else {
  console.error(body.error.code, body.error.message);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape Twitch user videos",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/twitch/user/videos",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "handle",
              "value": "shroud"
            },
            {
              "name": "type",
              "value": "highlight"
            },
            {
              "name": "sort",
              "value": "views"
            },
            {
              "name": "limit",
              "value": "10"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_d60acf6cd59f9e464094749b",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "post",
        "platform": "twitch",
        "id": "1526143078",
        "url": "https://www.twitch.tv/videos/1526143078",
        "type": "video",
        "author": {
          "id": "37402112",
          "handle": "shroud",
          "name": "shroud",
          "url": "https://www.twitch.tv/shroud",
          "avatar_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/c754eebf-745b-4e0a-814a-10bcaecaabbc-profile_image-300x300.png",
          "verified": null
        },
        "title": "Highlight: the grind continues......?",
        "text": null,
        "published_at": "2022-07-08T19:28:43Z",
        "duration_seconds": 2616.0,
        "language": "en",
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": 37725,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/a79dbbd4e2da30dfc62a_shroud_14459702619_3278251629//thumb/thumb1526143078-320x180.jpg",
          "video_url": null,
          "audio_url": null,
          "image_urls": null,
          "width": null,
          "height": null
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "animated_preview_url": "https://d2nvs31859zcd8.cloudfront.net/a79dbbd4e2da30dfc62a_shroud_14459702619_3278251629/storyboards/1526143078-strip-0.jpg",
          "broadcast_type": "highlight",
          "created_at": "2022-07-08T19:28:43Z",
          "game": "VALORANT",
          "game_id": "516575",
          "status": "recorded"
        }
      },
      {
        "object": "post",
        "platform": "twitch",
        "id": "1995417333",
        "url": "https://www.twitch.tv/videos/1995417333",
        "type": "video",
        "author": {
          "id": "37402112",
          "handle": "shroud",
          "name": "shroud",
          "url": "https://www.twitch.tv/shroud",
          "avatar_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/c754eebf-745b-4e0a-814a-10bcaecaabbc-profile_image-300x300.png",
          "verified": null
        },
        "title": "GTA 6 Trailer",
        "text": null,
        "published_at": "2023-12-04T23:40:23Z",
        "duration_seconds": 806.0,
        "language": "en",
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": 19254,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/aa4d47db4f3d6723dd36_shroud_72253881914_5037481556/thumb/custom-c67b8f7c-dff9-4184-a710-dcb008063a72-320x180.png",
          "video_url": null,
          "audio_url": null,
          "image_urls": null,
          "width": null,
          "height": null
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "animated_preview_url": "https://d2nvs31859zcd8.cloudfront.net/aa4d47db4f3d6723dd36_shroud_72253881914_5037481556/storyboards/1995417333-strip-0.jpg",
          "broadcast_type": "highlight",
          "created_at": "2023-12-04T23:40:23Z",
          "game": "World of Warcraft",
          "game_id": "18122",
          "status": "recorded"
        }
      }
    ],
    "cursor": null,
    "has_more": false,
    "parent": {
      "object": "profile",
      "platform": "twitch",
      "id": "37402112",
      "handle": "shroud",
      "name": "shroud",
      "headline": null,
      "url": "https://www.twitch.tv/shroud",
      "kind": "channel",
      "bio": null,
      "avatar_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/c754eebf-745b-4e0a-814a-10bcaecaabbc-profile_image-300x300.png",
      "banner_url": null,
      "verified": null,
      "is_private": null,
      "external_url": null,
      "links": null,
      "location": null,
      "category": null,
      "created_at": null,
      "stats": {
        "followers": null,
        "following": null,
        "posts": null,
        "likes": null,
        "views": null
      },
      "extra": null
    }
  },
  "cursor": null,
  "has_more": false
}

Response#

A list of Post objects in data.items, with data.cursor and data.has_more.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.