GET /v1/youtube/stored/post/comments
YouTube stored comments API: a video's saved comments by video ID
Returns the comments we have stored for one video, in the order we stored them: comment id, author, text, likes, reply count and relative date, plus stored_total. Send q as a video id or URL, and send next_cursor back as cursor while has_more is true. A stored video with no saved comments answers an empty list, and a video we never stored is a 404; collect comments live with the YouTube comments API.
- Price
- $0.0005 per call
- Batch
- Yes, through /v1/batch
- Failed calls
- Not charged
Example request
curl 'https://api.virev.ai/v1/youtube/stored/post/comments?q=dQw4w9WgXcQ' \
-H "Authorization: Bearer $VIREV_API_KEY"import os
import requests
response = requests.request(
"GET",
"https://api.virev.ai/v1/youtube/stored/post/comments",
params={
"q": "dQw4w9WgXcQ",
},
headers={"Authorization": f"Bearer {os.environ['VIREV_API_KEY']}"},
timeout=60,
)
response.raise_for_status()
print(response.json())Parameters
| Name | In | Type | Description |
|---|---|---|---|
q required | query | string | YouTube video id, or a watch, Shorts or youtu.be URL. |
cursor | query | string | Opaque next_cursor from the previous page. |
limit | query | integer | Comments per page. |
Example response
The example response of the API reference.
{
"data": {
"post": {
"video_id": "dQw4w9WgXcQ"
},
"comments": [
{
"comment_id": "UgzthbIGrJkqH1XU_bt4AaABAg",
"parent_comment_id": null,
"author": "srtboy54",
"text": "Who else got Rick Rolled by Matty McTech?",
"likes": 10000,
"replies": 414,
"published_text": "3 weeks ago",
"reply_level": 0
},
{
"comment_id": "UgzssGo7up_iorj07qp4AaABAg",
"parent_comment_id": null,
"author": "AdrianLikesGaming",
"text": "Bro i just scanned the qr code...",
"likes": 210,
"replies": 9,
"published_text": "1 day ago",
"reply_level": 0
}
],
"stored_total": 111,
"next_cursor": "WzM1XQ",
"has_more": true
},
"meta": {
"cost": "$0.0005",
"balance": "$9.9995",
"request_id": "req_ee6bdbb77a396ce98fa87fd87465d98e"
}
}How it works
The comments stored for one video, in the order they were stored, with next_cursor while has_more is true. A stored video with no collected comment page answers an empty list.
Strictly DB: this reads what the crawler already stored and never crawls. A miss is a 404 and is not billed. Collect more with /v1/youtube/video_comments.
Errors
| Status | When |
|---|---|
400 | The request parameters are invalid. |
401 | Missing, malformed, or revoked API key. |
402 | Balance is too low for this request. |
404 | The video is not stored. You are not charged. |
429 | Over the per-minute limit. The limit belongs to your organization and all its API keys share it: 100 requests per minute unless an increase was granted. Wait for the Retry-After seconds, then retry. On a live read, code rate_limited means the platform itself rate-limited this read; retry after the Retry-After seconds. You are not charged. |
502 | The upstream fetch failed. You are not charged. |
503 | Billing could not be confirmed, so no upstream data was returned. |
504 | The upstream request timed out. You are not charged. |