YouTube channel playlists API
Playlists from a channel's Playlists tab: id, title, thumbnail, video count and URL.
GET /v1/youtube/channel/playlists
GET /v1/youtube/channel/playlists
Playlists from a channel's Playlists tab: id, title, thumbnail, video count and URL.
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
handle | string | one of | Channel handle, with or without @. Also accepted as username. |
id | string | one of | Channel id (UC...). Also accepted as channelId, channel_id. |
url | URL | one of | Any 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:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.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/playlists" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "handle=NASA"1import os2import requests34params = {5 "handle": "NASA",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/youtube/channel/playlists",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/youtube/channel/playlists");2url.search = new URLSearchParams({3 "handle": "NASA"4}).toString();5const res = await fetch(url, {6 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },7});8const body = await res.json();910if (body.ok) {11 console.log(body.data);12} else {13 console.error(body.error.code, body.error.message);14}1{2 "nodes": [3 {4 "name": "SocialScrape YouTube channel playlists",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/youtube/channel/playlists",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "handle",19 "value": "NASA"20 }21 ]22 },23 "sendHeaders": true,24 "headerParameters": {25 "parameters": [26 {27 "name": "x-api-key",28 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"29 }30 ]31 }32 }33 }34 ],35 "connections": {}36}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_9828d9a8e516e6c3a87a4e07",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "collection",13 "platform": "youtube",14 "id": "PLF98rxtslw6s",15 "url": "https://www.youtube.com/playlist?list=PLF98rxtslw6s",16 "kind": "playlist",17 "title": "Nancy Grace Roman Space Telescope",18 "description": null,19 "owner": {20 "id": "UCLA_DiR1FfKNvjuUpBHmylQ",21 "handle": "NASA",22 "name": "NASA",23 "url": "https://www.youtube.com/@NASA",24 "avatar_url": null,25 "verified": null26 },27 "item_count": 3,28 "cover_url": "https://i.ytimg.com/vi/9wq3VHsL_bE/hqdefault.jpg?sqp=-oaymwEXCOADEI4CSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLCC7609JJdE1ic8h5PLtaCFmDRDYg",29 "updated_at": null,30 "extra": null31 },32 {33 "object": "collection",34 "platform": "youtube",35 "id": "PLB29CbKaE2OY",36 "url": "https://www.youtube.com/playlist?list=PLB29CbKaE2OY",37 "kind": "playlist",38 "title": "NASA Moon Base",39 "description": null,40 "owner": {41 "id": "UCLA_DiR1FfKNvjuUpBHmylQ",42 "handle": "NASA",43 "name": "NASA",44 "url": "https://www.youtube.com/@NASA",45 "avatar_url": null,46 "verified": null47 },48 "item_count": 9,49 "cover_url": "https://i.ytimg.com/pl_c/PLB29CbKaE2OY/studio_square_thumbnail.jpg?sqp=COf4j9cG-oaymwEICIAKENAFSFqi85f_AwYIqMLO0wY=&rs=AOn4CLBCTs47CUQAUcwD04UtDVoekixpbw",50 "updated_at": null,51 "extra": null52 }53 ],54 "cursor": "o30",55 "has_more": true,56 "parent": null57 },58 "cursor": "o30",59 "has_more": true60}Response#
A list of Collection 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.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
unsupported_url | 400 | no | The URL is not one this endpoint accepts (wrong platform or form). |
not_found | 404 | no | The 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.
Related endpoints#
- YouTube channel details (
GET /v1/youtube/channel) - YouTube channel videos (
GET /v1/youtube/channel/videos) - Search inside a YouTube channel (
GET /v1/youtube/channel/search) - YouTube channel Shorts (
GET /v1/youtube/channel/shorts) - YouTube channel live streams (
GET /v1/youtube/channel/lives) - YouTube channel community posts (
GET /v1/youtube/channel/community-posts) - YouTube video or Short details (
GET /v1/youtube/video) - YouTube video transcript (
GET /v1/youtube/video/transcript)