YouTube channel live streams API
  1. Docs
  2. YouTube
  3. YouTube channel live streams API

YouTube channel live streams API

Live and past streams from a channel's Live tab.

GET /v1/youtube/channel/lives

GET /v1/youtube/channel/lives

Live and past streams from a channel's Live tab. For a stream that is on air now, stats.views is the number watching, as YouTube's tab prints it.

  • Cost: 1 credit
  • 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
handlestringone ofChannel handle, with or without @. Also accepted as username.
idstringone ofChannel id (UC...). Also accepted as channelId, channel_id.
urlURLone ofAny channel URL (/@handle, /channel/UC..., /c/name). Accepted hosts: youtube.com, youtu.be.

Send at least one of handle, id, url. If you send several, the first listed is used and the rest are ignored.

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).

1curl -G "https://api.socialscrape.dev/v1/youtube/channel/lives" \2  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3  --data-urlencode "handle=NASA"

Example response#

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

200 OKSample response
1{2  "ok": true,3  "credits_charged": 1,4  "credits_remaining": 4999,5  "cached": false,6  "cached_at": null,7  "request_id": "req_888c3d8d00c3558f6040e106",8  "data": {9    "object": "list",10    "items": [11      {12        "object": "post",13        "platform": "youtube",14        "id": "ROboUHfPUrU",15        "url": "https://www.youtube.com/watch?v=ROboUHfPUrU",16        "type": "live",17        "author": {18          "id": "UCLA_DiR1FfKNvjuUpBHmylQ",19          "handle": "NASA",20          "name": "NASA",21          "url": "https://www.youtube.com/@NASA",22          "avatar_url": null,23          "verified": null24        },25        "title": "Live High-Definition Views from the International Space Station (Official NASA Stream)",26        "text": null,27        "published_at": null,28        "duration_seconds": null,29        "language": null,30        "hashtags": null,31        "mentions": null,32        "stats": {33          "views": 96,34          "likes": null,35          "comments": null,36          "shares": null,37          "saves": null,38          "dislikes": null39        },40        "media": {41          "thumbnail_url": "https://i.ytimg.com/vi/ROboUHfPUrU/mqdefault.jpg",42          "video_url": null,43          "audio_url": null,44          "image_urls": null,45          "width": null,46          "height": null47        },48        "song": null,49        "location": null,50        "is_pinned": null,51        "is_sponsored": null,52        "extra": null53      },54      {55        "object": "post",56        "platform": "youtube",57        "id": "M3HKLzjvKPc",58        "url": "https://www.youtube.com/watch?v=M3HKLzjvKPc",59        "type": "live",60        "author": {61          "id": "UCLA_DiR1FfKNvjuUpBHmylQ",62          "handle": "NASA",63          "name": "NASA",64          "url": "https://www.youtube.com/@NASA",65          "avatar_url": null,66          "verified": null67        },68        "title": "Live Video from the International Space Station (Official NASA Stream)",69        "text": null,70        "published_at": null,71        "duration_seconds": null,72        "language": null,73        "hashtags": null,74        "mentions": null,75        "stats": {76          "views": 88,77          "likes": null,78          "comments": null,79          "shares": null,80          "saves": null,81          "dislikes": null82        },83        "media": {84          "thumbnail_url": "https://i.ytimg.com/vi/M3HKLzjvKPc/mqdefault.jpg",85          "video_url": null,86          "audio_url": null,87          "image_urls": null,88          "width": null,89          "height": null90        },91        "song": null,92        "location": null,93        "is_pinned": null,94        "is_sponsored": null,95        "extra": null96      }97    ],98    "cursor": "o30",99    "has_more": true,100    "parent": null101  },102  "cursor": "o30",103  "has_more": true104}

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.
unsupported_url400noThe URL is not one this endpoint accepts (wrong platform or form).
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.