Scraper APIYouTube
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.
- 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; what a run costs is in Usage and units.
Inputs
The fields of input. A field that is not listed here is refused.
| Field | Type | Description |
|---|---|---|
url | string | The video's address: a youtube.com/watch, youtu.be, /shorts/, /live/ or /embed/ link.Limit: at most 500 characters. |
video_id | string | The video's 11-character id.Limit: at most 500 characters. |
sort | "top" | "newest" | The order: "top" (YouTube's default ranking) or "newest" first.Default: "top". |
max_results | integer | 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 | 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
urlandvideo_id. Both, or neither, is refused withinvalid_input. sortistop(YouTube's own ranking, the default) ornewest. A comment the channel pinned comes first in either order, withpinnedtrue.- Comments load 20 at a time.
max_resultsis 20 by default and goes up to 500, replies included; a larger number takes longer. If a later batch cannot be loaded, the run endspartialwith the comments it has. replies_per_commentis 0 by default: top-level comments only, each with itsreply_count. Above 0, up to that many replies follow each comment that has some, withis_replytrueand the comment's id inparent_id.published_textis the time as YouTube words it ("3 weeks ago"); it shows no exact time.like_countis 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
okwith 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 rununsupportedwithcomments_unavailable. A video that does not exist ends itfailedwithnot_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
# Start a run and wait up to 60 seconds for it to finish
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}}'
# Read its records, with the id the first call answered
curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
-H "Authorization: Bearer $ENRICHEDNOW_API_KEY"from enrichednow import EnrichedNow
client = EnrichedNow() # reads ENRICHEDNOW_API_KEY
# Start a run, wait for it to end, and get its records
result = client.scrape("youtube.comments", {
"video_id": "jfKfPfyJRdk",
"max_results": 6,
})
print(result.run.id, result.run.status, result.run.record_count)
# Read its records: pages are fetched as you go
for record in result.records:
print(record)Install it with pip install enrichednow, then save as run.py and run python3 run.py
import EnrichedNow from "enrichednow";
const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
// Start a run, wait for it to end, and get its records
const { run, records } = await client.scrape("youtube.comments", {
video_id: "jfKfPfyJRdk",
max_results: 6,
});
console.log(run.id, run.status, run.record_count);
// Read its records: pages are fetched as you go
for await (const record of records) console.log(record);Install it with npm install enrichednow, then save as run.mjs and run node run.mjs
package main
import (
"context"
"fmt"
"log"
"time"
enrichednow "github.com/enrichednow/enrichednow-go"
)
func main() {
client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()
// Start a run, wait for it to end, and get its records
run, records, err := client.Scrape(ctx, "youtube.comments", map[string]any{"video_id": "jfKfPfyJRdk", "max_results": 6})
if err != nil {
log.Fatal(err)
}
fmt.Println(run.ID, run.Status, run.RecordCount)
// Read its records: pages are fetched as you go
for records.Next() {
fmt.Println(string(records.Current()))
}
if err := records.Err(); err != nil {
log.Fatal(err)
}
}Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go
import com.enrichednow.EnrichedNowClient;
import com.enrichednow.ScrapeResult;
import java.util.Map;
public class Run {
public static void main(String[] args) {
EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
// Start a run, wait for it to end, and get its records
ScrapeResult result = client.scrape("youtube.comments", Map.of("video_id", "jfKfPfyJRdk", "max_results", 6));
System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
// Read its records: pages are fetched as you go
for (Map<String, Object> record : result.records()) {
System.out.println(record);
}
}
}Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java
enrichednow run youtube.comments --input video_id=jfKfPfyJRdk --input max_results=6Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh
It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.
The body on its own:
{
"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.
{
"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.
{
"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 lists every status and the reasons every scraper shares; the reasons of the YouTube scrapers are in their own section there.