# YouTube Comments Scraper — public web endpoint, no login (`pappy-dev/youtube-comments`) Actor

Scrape comments (and replies) from any public YouTube video using the same public endpoint YouTube's own video page calls in your browser. No login, no API key, no official Data API quota. Get comment text, author handle, like count, reply count, timestamps. PII in text is auto-redacted.

- **URL**: https://apify.com/pappy-dev/youtube-comments.md
- **Developed by:** [Backyard Tools](https://apify.com/pappy-dev) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 comment scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Comments Scraper — public web endpoint, no login

Scrape comments from any public YouTube video — no login, no API key setup, no official Data
API quota. This actor reads the same public API key and continuation token every video page
embeds for its own comment section, and posts them to the same public endpoint
(`youtubei/v1/next`) the page itself calls to show you comments as you scroll.

### Tested (2026-09-02)

5 real videos across 3 languages and very different comment volumes:

| Video | Language | Scale | Comments returned |
|---|---|---|---:|
| jNQXAC9IVRw (first YouTube video ever) | English | huge | 100/100 requested |
| SX_ViT4Ra7k | Japanese | huge | 100/100 requested |
| kJQP7kiw5Fk | Spanish | huge | 100/100 requested |
| K3_U7lm_t8Y | German | medium (62K views) | 24 (all available) |
| FJfKf4AEWmk | Japanese | tiny (183 views) | 0 (video has no comments posted yet) |

Replies were also tested (`:includeReplies=yes` on K3_U7lm_t8Y): 24 top-level + 12 replies
returned correctly, each reply carrying its parent comment's ID.

Collecting 1,000 comments from a high-volume video takes roughly 70-75 seconds, dominated by
the mandatory 1-second pace between requests (see Pricing below for why that's a good trade).

### How it works

Every YouTube video page embeds a public API key (`INNERTUBE_API_KEY`) and a continuation
token for its own comment section — the same values the page's own JavaScript reads to render
comments as you scroll. This actor reads those public values from the page HTML and posts them
straight back to YouTube's own `/youtubei/v1/next` endpoint, exactly as the page itself does.
No login, no cookies, no CAPTCHA-solving, no headless-browser fingerprint spoofing — just the
public page doing what it already does, at a deliberately slow pace (1+ second between every
request). On a 429 or 403 response this actor stops immediately rather than retrying or working
around it.

### Youtube comments scraper — input

```json
{
  "targets": ["jNQXAC9IVRw", "https://www.youtube.com/watch?v=SX_ViT4Ra7k:newest:yes"],
  "maxItems": 100
}
```

Each target is a video ID or full URL, optionally followed by `:sort` and `:includeReplies`:

- `VIDEO_ID` — top comments, no replies (default)
- `VIDEO_ID:newest` — sort by newest first (falls back to the video's default order with a log
  message on the rare video where the sort menu isn't available)
- `VIDEO_ID:top:yes` — also collect replies to every comment

We recommend keeping a single run to at most 1,000 comments per video — larger pulls take
proportionally longer because of the mandatory pacing.

### Youtube comments scraper — output fields

One dataset item per comment (or reply):

| Field | |
|---|---|
| `comment_id` | YouTube's comment ID (a reply's ID is `parentId.replyId`) |
| `video_id` | the video this comment belongs to |
| `author` | commenter's public display handle (e.g. `@someone`) — not a real name |
| `author_channel_url` | link to the commenter's public channel |
| `text` | comment body. Anything that looks like an email address, phone number, or postal address is replaced with `[redacted-*]` before it leaves this actor |
| `like_count` | like count as YouTube itself displays it (e.g. `"23K"`, `"4"`) — YouTube does not expose an exact integer for large counts, so this actor doesn't invent one |
| `reply_count` | number of replies to this comment (`"0"` if none) |
| `published` | YouTube's relative time text (e.g. `"6 years ago"`, `"3 days ago (edited)"`) |
| `date` | day-granularity **estimate** of `published`, computed from this run's retrieval time — YouTube's public endpoint never returns an exact timestamp, so treat this as approximate, not authoritative |
| `retrieved_at` | UTC timestamp of this run (the anchor `date` is estimated from) |
| `is_reply` | `true` if this is a reply rather than a top-level comment |
| `parent_id` | the parent comment's ID, present only on replies |

No real name, email, phone number, or physical address is ever output — author fields are
public handles, and PII-shaped substrings inside comment text are redacted (see `text` above).

### Analyses (billed once per run, not per comment)

| Analysis | What you get |
|---|---|
| `overview` | count, negative-sentiment share (keyword-based — comments carry no star rating), first/last seen |
| `top-complaints` | actual excerpts of comments carrying negative-sentiment language |
| `top-requests` | actual excerpts asking for something ("please add...", "you should...") |
| `trend` | monthly comment volume and negative-sentiment share |

### Use Cases

- **Launch feedback mining** — pull comments on a new video and run `top-complaints` /
  `top-requests` to see the actual phrases viewers use, not a guess at sentiment
- **Sentiment trend tracking** — run `trend` on a channel's uploads over time to watch
  comment volume and negative-sentiment share shift release to release
- **Competitor video research** — collect comments on a competitor's video to see what
  their audience praises or complains about, in their own words
- **Reply-thread review** — `:top:yes` pulls full reply threads under a comment, useful
  for community moderation or discourse research on a specific topic thread

### Pricing

Pay per event: **$1.00 per 1,000 comments** collected, plus **$0.05 per analysis** you select.
Comparable actors in this category price between $0.25 and $4.00 per 1,000 — this sits in the middle.

# Actor input Schema

## `targets` (type: `array`):

Video ID (11 characters) or video URL. Optionally append ":sort" (top = default / newest) and ":includeReplies" (yes / no = default), e.g. "jNQXAC9IVRw", "jNQXAC9IVRw:newest", "jNQXAC9IVRw:top:yes".

## `maxItems` (type: `integer`):

Maximum number of items to collect in one run.

## `analyses` (type: `array`):

Analyses to run (each selected analysis is charged as one event).

## Actor input object example

```json
{
  "targets": [
    "jNQXAC9IVRw"
  ],
  "maxItems": 100,
  "analyses": [
    "overview",
    "top-complaints",
    "top-requests",
    "trend"
  ]
}
```

# Actor output Schema

## `items` (type: `string`):

Every collected record (type=item) and the result of each selected analysis (type=analysis)

## `overview` (type: `string`):

Link to this run's page: status, log and dataset

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "targets": [
        "jNQXAC9IVRw"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pappy-dev/youtube-comments").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "targets": ["jNQXAC9IVRw"] }

# Run the Actor and wait for it to finish
run = client.actor("pappy-dev/youtube-comments").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "targets": [
    "jNQXAC9IVRw"
  ]
}' |
apify call pappy-dev/youtube-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pappy-dev/youtube-comments"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/yjNMk4HduEHjvlUk0/builds/37jXJmY0uA43SnZoh/openapi.json
