YouTube bulk videos API
Up to 50 YouTube videos by id in one call, with details and exact view and like counts, for five credits.
POST /v1/youtube/videos/batchBeta5 credits per callRefunded on failureimport os, requests
res = requests.post(
"https://api.groundsocial.dev/v1/youtube/videos/batch",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
json={"ids":["dQw4w9WgXcQ","AVO0ifle-OU"]},
)
res.raise_for_status()
data = res.json()Response
200 · 5 credits{ "kind": "youtube#videoListResponse", "items": [ { "kind": "youtube#video", "id": "dQw4w9WgXcQ", "snippet": { "publishedAt": "2009-10-25T06:57:33.000Z", "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw", "channelTitle": "Rick Astley", "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)", "description": "The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Au…", "thumbnails": { "…": "5 fields" }, "tags": [ "…" ], "category": "Music", "categoryId": "10", "liveBroadcastContent": "none", "…": "1 more fields" }, "contentDetails": { "duration": "PT3M33S", "durationSeconds": 213, "caption": "true" }, "statistics": { "viewCount": "1840617441", "likeCount": "19517793", "commentCount": "2462543" }, "status": { "privacyStatus": "public", "embeddable": true, "isFamilySafe": true }, "paidProductPlacementDetails": { "hasPaidProductPlacement": false }, "isShort": false, "channel": { "id": "UCuAXFkgsw1L7xaCfnd5JJOw", "title": "Rick Astley", "handle": "@RickAstleyYT", "url": "https://www.youtube.com/@RickAstleyYT", "thumbnails": { "…": "3 fields" }, "subscriberCount": "4560000", "isVerified": true, "isArtist": true }, "captionTracks": [ { "…": "4 fields" }, "… 5 more" ], "…": "2 more fields" }, "… 1 more" ], "pageInfo": { "totalResults": 2, "resultsPerPage": 2 }}Response fields
200 with a YouTubeVideoList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#videoListResponse" | |
items | YouTubeVideo[] | |
nextPageToken | string | Pass as after for the next page. Absent on the last page. Lasts 6 hours. |
pageInfo | object | |
missing | object[] | Batch only: requested ids that did not resolve, and why. |
Status codes
| Status | Meaning |
|---|---|
200 | The videos, in the order asked, and the ids that did not resolve. |
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
Does it include comment counts?
No: the batch reads each video’s player data only. Use the single video endpoint for comment counts, chapters and up next.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.