# youtube.comments

The comments under a YouTube video, top or newest first, with replies on request: text, likes, reply count, time, pinned and hearted marks, and the author's channel.

YouTube comments, one of the YouTube scrapers.

| | |
| --- | --- |
| Id | `youtube.comments` |
| Version | 1 |
| Billed per | record — 1 unit for each record of a charged run |
| Runs | within one request |

Start it with `POST /v1/scrapers/youtube.comments/runs`. How runs work is in [Running a scraper](https://docs.enrichednow.com/running-a-scraper.md); what a run costs is in [Usage and units](https://docs.enrichednow.com/usage-and-units.md).

## Inputs

The fields of `input`. A field that is not listed here is refused.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | no | The video's address: a youtube.com/watch, youtu.be, /shorts/, /live/ or /embed/ link. Limit: at most 500 characters. |
| `video_id` | string | no | The video's 11-character id. Limit: at most 500 characters. |
| `sort` | "top" \| "newest" | no | The order: "top" (YouTube's default ranking) or "newest" first. Default: `"top"`. |
| `max_results` | integer | no | The most comments to return, replies included. Comments load 20 at a time, so a larger number takes longer. Limit: 1 to 500. Default: `20`. |
| `replies_per_comment` | integer | no | How many replies to return under each comment that has some. 0 returns top-level comments only. Limit: 0 to 50. Default: `0`. |

- Give exactly one of `url` and `video_id`. Both, or neither, is refused with `invalid_input`.
- `sort` is `top` (YouTube's own ranking, the default) or `newest`. A comment the channel pinned comes first in either order, with `pinned` `true`.
- Comments load 20 at a time. `max_results` is 20 by default and goes up to 500, replies included; a larger number takes longer. If a later batch cannot be loaded, the run ends `partial` with the comments it has.
- `replies_per_comment` is 0 by default: top-level comments only, each with its `reply_count`. Above 0, up to that many replies follow each comment that has some, with `is_reply` `true` and the comment's id in `parent_id`.
- `published_text` is the time as YouTube words it ("3 weeks ago"); it shows no exact time. `like_count` is exact below a thousand and the rounded figure YouTube shows above ("223K" is 223000).
- The author is returned as shown beside the comment: the name (usually a handle), the channel id and the channel's address. No picture is returned, and comments are read by video only.
- A video with comments turned off, or with no comments yet, ends `ok` with zero records. A stream that is on air has a live chat and no comments, and a video behind a sign-in shows none: both end the run `unsupported` with `comments_unavailable`. A video that does not exist ends it `failed` with `not_found`.
- Billed per record: a charged run costs 1 unit for each comment or reply it returns.

## Record fields

Every record of a run has these fields. A value that is not known is `null` — never an empty string and never `0`.

| Field | Type | Notes |
| --- | --- | --- |
| `position` | integer | Its place among the returned records, from 1: comments in the order asked for, each followed by its replies. |
| `id` | string | The comment's id. |
| `video_id` | string | The id of the video it is under. |
| `url` | string | A link that opens the video with this comment highlighted. |
| `is_reply` | boolean | True for a reply to another comment, false for a top-level comment. |
| `parent_id` | string or null | For a reply: the id of the comment it answers; null for a top-level comment. |
| `text` | string or null | The comment's text. |
| `published_text` | string or null | When it was posted, as shown ("3 weeks ago"). |
| `edited` | boolean | YouTube marks the comment as edited. Default: `false`. |
| `like_count_text` | string or null | The likes as shown ("223K", "42"); null when no count is shown. |
| `like_count` | integer or null | The likes as a number: exact below a thousand, the rounded figure YouTube shows above; 0 when no count is shown. |
| `reply_count` | integer or null | For a top-level comment: how many replies it has; null for a reply. |
| `pinned` | boolean | The channel pinned this comment to the top. Default: `false`. |
| `hearted` | boolean | The channel gave this comment its heart. Default: `false`. |
| `author_name` | string or null | The author's name as shown beside the comment, usually a handle ("@name"). |
| `author_channel_id` | string or null | The author's channel id (UC…). |
| `author_channel_url` | string or null | The author's channel address, as the page links it. |
| `author_is_channel_owner` | boolean or null | True when the author is the channel that published the video. |
| `author_verified` | boolean or null | The author's channel shows a verified or official-artist badge. |

## Example request

It starts a run with this scraper's example input and waits up to 60 seconds for it. The key is read from `ENRICHEDNOW_API_KEY`.

```bash
curl -X POST "https://api.enrichednow.com/v1/scrapers/youtube.comments/runs?wait=60" \
  -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"video_id":"jfKfPfyJRdk","max_results":6}}'
```

## Example response

The run, once it has ended. A run that has not ended within `wait` comes back with `202` and the status `queued` or `running`.

```json
{
  "id": "run_841742f37553189ff9c27ba1",
  "scraper_id": "youtube.comments",
  "scraper_version": 1,
  "status": "ok",
  "reason": null,
  "input": {
    "video_id": "jfKfPfyJRdk",
    "max_results": 6
  },
  "record_count": 1,
  "units": 1,
  "units_per_request": null,
  "units_per_record": 1,
  "units_per_page": null,
  "diagnostics": {
    "requests": 1,
    "bytes": 259214,
    "wall_ms": 885,
    "facts": {}
  },
  "created_at": "2026-11-16T22:37:50.170950Z",
  "started_at": "2026-11-16T22:37:50.178331Z",
  "finished_at": "2026-11-16T22:37:51.066313Z"
}
```

Its records, from `GET /v1/runs/{id}/records`. The record is a real one: this scraper's own parser read it from a page recorded from the site.

```json
{
  "records": [
    {
      "position": 1,
      "id": "UgwMz6w7c5oC_ZvYmzB4AaABAg",
      "video_id": "jfKfPfyJRdk",
      "url": "https://www.youtube.com/watch?v=jfKfPfyJRdk&lc=UgwMz6w7c5oC_ZvYmzB4AaABAg",
      "is_reply": false,
      "parent_id": null,
      "text": "The radio is back online, join us now: https://youtu.be/EWrX250Zhko \nThank you for your patience🧡",
      "published_text": "5 months ago",
      "edited": false,
      "like_count_text": "42",
      "like_count": 42,
      "reply_count": 2,
      "pinned": true,
      "hearted": false,
      "author_name": "@LofiGirl",
      "author_channel_id": "UCSJ4gkVC6NrvII8umztf0Ow",
      "author_channel_url": "https://www.youtube.com/@LofiGirl",
      "author_is_channel_owner": true,
      "author_verified": true
    }
  ],
  "next_cursor": null
}
```

A run does not always end `ok`. [Results and statuses](https://docs.enrichednow.com/results-and-statuses.md#reason-codes) lists every status and the reasons every scraper shares; [the reasons of the YouTube scrapers](https://docs.enrichednow.com/results-and-statuses.md#youtube) are in their own section there.
