# 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

## 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](https://xtikapi.com/apis/youtube/comments/list): `GET /v1/youtube/comments/list`, $0.002 a call

```bash
curl "https://xtikapi.com/v1/youtube/comments/list?id=CLsCU_JX1eU" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```python
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")
```

```javascript
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):

```json
{
  "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

| Step | Calls | Price | Subtotal |
| --- | --- | --- | --- |
| Comments, 10 pages of 20 | 10 | $0.002 | $0.02 |
| Total | 10 | | $0.02 |

## Good to know

- A page held 20 comments in our test on 2026-11-22, and page two had no overlap.
- Pass `sort_by` to 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](https://xtikapi.com/apis/youtube/comments/list): $0.002 a call

## More about YouTube

- [yt-dlp YouTube errors ("confirm you're not a bot", incomplete comments): how do I get video data?](https://xtikapi.com/answers/yt-dlp-sign-in-to-confirm-not-a-bot)
- [Why does YouTube commentThreads.list return 403 commentsDisabled?](https://xtikapi.com/answers/youtube-api-comments-disabled-403)
- [How do I export all comments from a YouTube video?](https://xtikapi.com/answers/youtube-comments-export)
- [How do I get around the YouTube Data API's 10,000-unit daily quota?](https://xtikapi.com/answers/youtube-api-quota-alternative)

## 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.

---

XTikAPI: one API key for public social media data, prepaid per call. [HTML version](https://xtikapi.com/guides/youtube-video-comments-python) · [llms.txt](https://xtikapi.com/llms.txt) · [OpenAPI](https://xtikapi.com/openapi.json)
