YouTube comment replies API
The replies under one YouTube comment, 10 then about 50 a page: by video and comment id, or from the repliesToken the comments endpoint gives each thread.
GET /v1/youtube/comments/repliesBeta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/comments/replies?video=dQw4w9WgXcQ&comment=UgwPwTibxdgqCHZxktd4AaABAg",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#commentListResponse", "items": [ { "kind": "youtube#comment", "id": "UgyyEqaBXOKgoi4cf7l4AaABAg.91gIx12DL8691gaRhezMzJ", "snippet": { "parentId": "UgwPwTibxdgqCHZxktd4AaABAg", "authorDisplayName": "@JetpackGamer456", "authorProfileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_nyhrpC59MDbvwlTlkeHmG6xvzXfJQdI4SBR7r8a5XLhJg=s88-c-k-c0x00ffffff-no-rj", "authorChannelUrl": "https://www.youtube.com/@JetpackGamer456", "authorChannelId": { "value": "UCNRtoaGfHCLksAz2ofEAfgA" }, "textDisplay": "yeetmaster I hate autocorrect lol", "textOriginal": "yeetmaster I hate autocorrect lol", "likeCount": 6900, "likeCountIsApproximate": true, "publishedAt": "2019-11-26T12:00:00.000Z", "publishedTimeText": "7 years ago", "videoId": "dQw4w9WgXcQ" } }, { "kind": "youtube#comment", "id": "UgyyEqaBXOKgoi4cf7l4AaABAg.91gIx12DL8691hCh_vXHtk", "snippet": { "parentId": "UgwPwTibxdgqCHZxktd4AaABAg", "authorDisplayName": "@PopCrusher", "authorProfileImageUrl": "https://yt3.ggpht.com/M4nzO-U6UcZRi8zVvfM5bG36kcPtJ0AB3qIxjOcJhKoHLn1J9J4kZitoq6UgeDuWqUhmeoAKgw=s88-c-k-c0x00ffffff-no-…", "authorChannelUrl": "https://www.youtube.com/@PopCrusher", "authorChannelId": { "value": "UCngdk2Q5F_ilve32yl_iQZA" }, "textDisplay": "Ok, so this boy in my class rickrolled every kid in my class in oNE DAY. ONE FREAKING DAY. He posted the link on Google …", "textOriginal": "Ok, so this boy in my class rickrolled every kid in my class in oNE DAY. ONE FREAKING DAY. He posted the link on Google …", "likeCount": 9800, "likeCountIsApproximate": true, "publishedAt": "2019-11-26T12:00:00.000Z", "publishedTimeText": "7 years ago", "videoId": "dQw4w9WgXcQ" } }, "… 1 more" ], "pageInfo": { "resultsPerPage": 3 }}Parameters
| Name | Type | Description |
|---|---|---|
videoquery | string | The video the comment is on (id or URL), with comment. Example: dQw4w9WgXcQ. |
commentquery | string | A top-level comment id, with video. Example: UgwPwTibxdgqCHZxktd4AaABAg. |
afterquery | string | A thread’s repliesToken, or the previous replies page’s nextPageToken. |
textFormatquery | "html" | "plainText" | html (default) or plainText. One of html, plainText. |
Response fields
200 with a YouTubeCommentList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#commentListResponse" | |
items | YouTubeComment[] | |
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 replies. |
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
How long do tokens last?
Six hours.
Which comment id?
The id of a thread from the comments endpoint (a top-level comment, Ug…), with its video.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.