YouTube playlist API
A YouTube playlist and its videos, 100 a page, as Data API youtube#playlistItems, with the playlist’s title, owner and counts on the first page.
GET /v1/youtube/playlists/{id}Beta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/playlists/PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#playlistItemListResponse", "playlist": { "kind": "youtube#playlist", "id": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI", "snippet": { "title": "Popular Music Videos", "channelId": "UC-9-kyTW8ZkZNDHQJ6FgpwQ", "channelTitle": "Music", "thumbnails": { "high": { "url": "https://i.ytimg.com/vi/fOT0BUpITw8/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLDjsUIQ80ddZ3EkanN…" } } }, "contentDetails": { "itemCount": 182 }, "statistics": { "viewCount": "1045679119" } }, "items": [ { "kind": "youtube#playlistItem", "id": "fOT0BUpITw8", "snippet": { "playlistId": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI", "position": 0, "title": "BELLAKEO (Video Oficial) - Peso Pluma, Anitta", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/fOT0BUpITw8/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/fOT0BUpITw8/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/fOT0BUpITw8/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/fOT0BUpITw8/sddefault.jpg", "width": 640, "height": 480 } }, "resourceId": { "kind": "youtube#video", "videoId": "fOT0BUpITw8" }, "videoOwnerChannelId": "UCzrM_068Odho89mTRrrxqbA", "videoOwnerChannelTitle": "Peso Pluma" }, "contentDetails": { "videoId": "fOT0BUpITw8", "duration": "PT3M55S", "durationSeconds": 235 }, "statistics": { "viewCount": "781000000" } }, { "kind": "youtube#playlistItem", "id": "NFvDHYMzj9U", "snippet": { "playlistId": "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI", "position": 1, "title": "Arcángel - FN8 ( Video Lyric )", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/NFvDHYMzj9U/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/NFvDHYMzj9U/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/NFvDHYMzj9U/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/NFvDHYMzj9U/sddefault.jpg", "width": 640, "height": 480 } }, "resourceId": { "kind": "youtube#video", "videoId": "NFvDHYMzj9U" }, "videoOwnerChannelId": "UCu4bj03KW4CwAsYtHSwMEsQ", "videoOwnerChannelTitle": "Arcangel" }, "contentDetails": { "videoId": "NFvDHYMzj9U", "duration": "PT10M50S", "durationSeconds": 650 }, "statistics": { "viewCount": "32000000" } }, "… 1 more" ], "pageInfo": { "resultsPerPage": 6, "totalResults": 182 }}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | A playlist id (PL…, UU…, OLAK5uy_…) or any URL with list=. |
detailsquery | "0" | "1" | "true" | "false" | One of 0, 1, true, false. |
afterquery | string | The previous page’s nextPageToken. Tokens last 6 hours. |
Response fields
200 with a YouTubePlaylistItemList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#playlistItemListResponse" | |
playlist | object | |
items | YouTubePlaylistItem[] | |
nextPageToken | string | Pass as after for the next page. Absent on the last page. Lasts 6 hours. |
pageInfo | object |
Status codes
| Status | Meaning |
|---|---|
200 | A page of the playlist. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
Private playlists?
403 target_private, never charged.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.