YouTube playlist videos API
The playlist's videos; `parent` is the playlist itself.
GET /v1/youtube/playlist
GET /v1/youtube/playlist
The playlist's videos; parent is the playlist itself.
- 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 |
|---|---|---|---|
url | URL | one of | Playlist URL (list=...). Accepted hosts: youtube.com, youtu.be. |
id | string | one of | Playlist id (PL..., UU..., OL...). Also accepted as playlist_id, playlistId. |
Send at least one of url, id. 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/playlist" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "id=PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p"1import os2import requests34params = {5 "id": "PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/youtube/playlist",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/playlist");2url.search = new URLSearchParams({3 "id": "PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p"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 playlist videos",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/playlist",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "id",19 "value": "PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p"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_714ff6a10d51e7b72da00727",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "post",13 "platform": "youtube",14 "id": "JNCw3fUtwbs",15 "url": "https://www.youtube.com/watch?v=JNCw3fUtwbs",16 "type": "video",17 "author": {18 "id": null,19 "handle": null,20 "name": "NASA",21 "url": null,22 "avatar_url": null,23 "verified": null24 },25 "title": "Thanks for All the Gravity Assists",26 "text": null,27 "published_at": "2022-10-30T00:00:00Z",28 "duration_seconds": 392.0,29 "language": null,30 "hashtags": null,31 "mentions": null,32 "stats": {33 "views": 33000,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/JNCw3fUtwbs/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": {53 "published_at_approximate": true54 }55 },56 {57 "object": "post",58 "platform": "youtube",59 "id": "coFE7-E6LRg",60 "url": "https://www.youtube.com/watch?v=coFE7-E6LRg",61 "type": "video",62 "author": {63 "id": null,64 "handle": null,65 "name": "NASA",66 "url": null,67 "avatar_url": null,68 "verified": null69 },70 "title": "Gravity Assist: Listening to the Universe",71 "text": null,72 "published_at": "2021-10-30T00:00:00Z",73 "duration_seconds": 228.0,74 "language": null,75 "hashtags": null,76 "mentions": null,77 "stats": {78 "views": 82000,79 "likes": null,80 "comments": null,81 "shares": null,82 "saves": null,83 "dislikes": null84 },85 "media": {86 "thumbnail_url": "https://i.ytimg.com/vi/coFE7-E6LRg/mqdefault.jpg",87 "video_url": null,88 "audio_url": null,89 "image_urls": null,90 "width": null,91 "height": null92 },93 "song": null,94 "location": null,95 "is_pinned": null,96 "is_sponsored": null,97 "extra": {98 "published_at_approximate": true99 }100 }101 ],102 "cursor": null,103 "has_more": false,104 "parent": {105 "object": "collection",106 "platform": "youtube",107 "id": "PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p",108 "url": "https://www.youtube.com/playlist?list=PL2aBZuCeDwlTxZeGRlKrWpLiX_W7jpt6p",109 "kind": "playlist",110 "title": null,111 "description": null,112 "owner": null,113 "item_count": null,114 "cover_url": null,115 "updated_at": null,116 "extra": null117 }118 },119 "cursor": null,120 "has_more": false121}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.
| 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 playlists (
GET /v1/youtube/channel/playlists) - 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)