How to get YouTube video comments with Python
Pass the video ID and page with data.next, 20 comments a page. Ten pages are 200 comments for 10 calls and $0.02, with no Google Cloud project, OAuth or daily quota units.
Updated 2026-11-22·This page as Markdown
Page through the comments
id is the value after v= in a youtube.com link, or the part after youtu.be/. The next-page token is long; it arrives in data.next and goes back unchanged.
YouTube comments API·GET /v1/youtube/comments/list·$0.002 a call
curl "https://xtikapi.com/v1/youtube/comments/list?id=CLsCU_JX1eU" \
-H "Authorization: Bearer YOUR_API_KEY"import requests
URL = "https://xtikapi.com/v1/youtube/comments/list"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
params = {"id": "CLsCU_JX1eU"}
items = []
for _ in range(10): # one call per page
for attempt in range(3): # 5xx errors are not charged: retry
response = requests.get(URL, params=params, headers=HEADERS, timeout=60)
if response.status_code < 500:
break
response.raise_for_status()
data = response.json()["data"]
items += data["items"]
if not data.get("next"): # null on the last page
break
params.update(data["next"])
print(len(items), "items")const URL = "https://xtikapi.com/v1/youtube/comments/list";
const HEADERS = { Authorization: "Bearer YOUR_API_KEY" };
let params = {"id":"CLsCU_JX1eU"};
const items = [];
for (let page = 0; page < 10; page++) {
let response;
for (let attempt = 0; attempt < 3; attempt++) {
// 5xx errors are not charged: retry
response = await fetch(`${URL}?${new URLSearchParams(params)}`, { headers: HEADERS });
if (response.status < 500) break;
}
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { data } = await response.json();
items.push(...data.items);
if (!data.next) break; // null on the last page
params = { ...params, ...data.next };
}
console.log(items.length, "items");Recorded response (lists keep the first two items)
{
"data": {
"items": [
{
"id": "xxxxxxxx035xxx8xx2x0xxxxxx",
"text": "Example text",
"author": {
"id": "xx_xxxxxxxxxxxxxxx5x99xx",
"name": "Example name",
"avatar": "https://example.com/image.jpg"
},
"likeCount": 60,
"replyCount": 14
},
{
"id": "xxxx2xxxxxxxxxxx9x40xxxxxx",
"text": "Example text",
"author": {
"id": "xxxxxxxxx8xx7xx3xxxxxxxx",
"name": "Example name",
"avatar": "https://example.com/image.jpg"
},
"likeCount": 1530,
"replyCount": 79
}
],
"has_more": true,
"next": {
"cursor": "Eg0SC0NMc0NV…"
}
},
"meta": {
"request_id": "example",
"endpoint": "youtube.comments.list",
"normalized": true,
"unavailable": [
"createdAt"
],
"billing": {
"charged": true,
"amount": 0.002,
"balance": 4.98
}
}
}What the example costs
Failed calls and timeouts are not charged. A new account with a verified email gets $0.50 of trial balance, enough to run this example.
Good to know
- A page held 20 comments in our test on 2026-11-22, and page two had no overlap.
- Pass
sort_byto switch between top comments and newest first. - Replies are separate:
youtube.comment_replies.list. - The YouTube Data API v3 charges 1 quota unit per commentThreads page out of 10,000 a day; here there is no quota, only the per-call price.
Endpoints
- YouTube comments API · $0.002 a call
More about YouTube
Questions
How much does this cost with XTikAPI?
The example here is 10 calls, $0.02 in total. Failed calls and timeouts are free, and a new account with a verified email gets $0.50 of trial balance.
Is this the official YouTube Data API?
No. It reads the public comments shown on the video page, so it needs no Google API key or quota; the response uses the same comment shape as every other platform here.