# YouTube Comments Monitor — New Comments Only (`commanding_hotdog/youtube-comments-monitor`) Actor

No-login YouTube comments monitor: watch videos, channels or brand keywords and get only new comments — pay only for new ones. Reply trees, newest or top sort, residential proxy fallback, optional YouTube Data API v3 route. No cookies, no login.

- **URL**: https://apify.com/commanding_hotdog/youtube-comments-monitor.md
- **Developed by:** [qingwa](https://apify.com/commanding_hotdog) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 85.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 comments

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 Monitor — New Comments Only

Monitor YouTube comments **without logging in**: watch videos, channels or
brand keywords and get **only new comments** — pay only for new ones.

No cookies, no login, no API key required. The Actor talks to YouTube the
same way a browser does (InnerTube), with a residential proxy fallback and
an optional official YouTube Data API v3 route (your own key).

### What you get

- **Video mode** — paste video URLs or IDs (`videoUrls`): watch, youtu.be,
  shorts and live links all work.
- **Channel mode** — paste channel URLs (`channelUrls`): `@handle`,
  `/channel/UC...`, `/c/name`, `/user/name` or a bare `UC...` ID. The Actor
  reads the channel's latest videos (default 5) and fetches their comments.
- **Search mode** — type brand keywords (`searchTerms`): the top matching
  videos are found and their comments are fetched. Great for brand and
  competitor monitoring.
- **onlyNew (monitor mode)** — turn on `onlyNew` and run daily: only
  comments you have not seen are returned. Skipped comments are **never
  charged**, and seen-state is kept in a named key-value store so the next
  run picks up exactly where this one stopped.
- **Reply trees** — two levels (`parentCommentId` / `replyLevel` /
  `rootCommentId`), replies fetched across pages until the cap.
- **Sort** — `newest` (default, best for monitoring) or `top`.
- **Three routes** — InnerTube direct (main), residential proxy fallback
  (`proxyMode`: auto / none / residential), and official YouTube Data API
  v3 when you supply your own key in `apiKey`. Every row records which
  route delivered it (`routeUsed`).

### Pricing

- `comment` — **$0.002** per comment/reply ($2 per 1,000 comments).
- **First 20 comments per run are free.**
- Channel and video header rows, error rows and setup-guide rows are
  **never charged**.
- `Start` — $0.00005 per run (Apify platform fee).

### Output

One row per comment (itemType `comment`) or reply (itemType `reply`), plus
free header rows (itemType `channel` / `video`) and free error rows
(itemType `error`):

| Field | Description |
|---|---|
| commentId | YouTube comment ID (stable dedup key) |
| parentCommentId / rootCommentId / replyLevel | Two-level reply tree (0 = top, 1 = reply) |
| videoId / videoTitle / videoUrl | Source video |
| channelId / channelTitle | Source channel |
| author / authorChannelId | Comment author |
| text | Comment text |
| likeCount | Likes (nullable — YouTube's new entity structure reports it unstably) |
| replyCount | Number of replies on this comment |
| publishedAt | ISO timestamp (approx. for InnerTube, which only gives relative times) |
| publishedText / publishedHoursAgo | Original relative time + hours since posting |
| query / channelUrl | Input that produced the row |
| routeUsed | `direct` / `residential` / `api` |
| error / errorType | Free error rows: COMMENTS_DISABLED, VIDEO_NOT_FOUND, RATE_LIMITED, API_KEY_INVALID, BLOCKED, FETCH_ERROR, INVALID_URL, CHANNEL_NOT_FOUND, NO_RESULTS, SETUP_GUIDE |

`outputFormat: minimal` returns a compact subset (id, author, text, dates,
counts, route) for large monitoring runs.

### Usage examples

**Monitor a channel daily (onlyNew):**

```json
{
  "channelUrls": ["https://www.youtube.com/@mkbhd"],
  "maxVideosPerChannel": 5,
  "maxCommentsPerVideo": 100,
  "onlyNew": true,
  "stateStoreName": "youtube-comments-monitor-state"
}
```

**Watch a brand keyword:**

```json
{
  "searchTerms": ["AI tools"],
  "maxVideosPerSearch": 3,
  "maxCommentsPerVideo": 100,
  "sortBy": "newest"
}
```

**Official API route (your own key):**

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=_x58r9TBois"],
  "apiKey": "YOUR_YOUTUBE_DATA_API_V3_KEY"
}
```

### Known no-login limits

- `likeCount` is unstable in YouTube's new entity structure — nullable.
- Members-only, held-for-review and deleted comments are not visible
  without a login.
- Videos with comments turned off return a free `COMMENTS_DISABLED` row.
- No view counts on comments; no login-only content.
- The API route ignores `publishedAfter` on `commentThreads.list`
  (verified 2026-11-10): the Actor filters client-side by `publishedAt`
  and stops at the first old thread instead.

### How it works

1. **InnerTube route** — POSTs to YouTube's public `youtubei/v1/next`
   endpoint with a Chrome TLS fingerprint (curl_cffi). Comment threads
   carry only a `commentKey`; author, text and timestamps are read from
   `frameworkUpdates` entity mutations.
2. **Residential proxy fallback** — when the direct route is blocked, the
   same calls are retried through a residential proxy with a fresh client
   per attempt (a fresh connection = a fresh exit IP).
3. **API route** — `commentThreads.list` (1 quota unit per call) +
   `comments.list` for replies, `channels.list` + `playlistItems.list`
   for channel latest videos.

# Actor input Schema

## `apiKey` (type: `string`):

Your own YouTube Data API v3 key. When set, comments are fetched through the official API (1 quota unit per call). Leave empty to use the default InnerTube route (no key, no quota). The key is never stored by the Actor.

## `channelUrls` (type: `array`):

YouTube channel URLs (@handle, /channel/UC..., /c/name, /user/name) or bare UC... channel IDs. The Actor reads the channel's latest videos and fetches their comments.

## `deduplicate` (type: `boolean`):

Skip comments already returned in an earlier run even when onlyNew is off.

## `includeReplies` (type: `boolean`):

Fetch the two-level reply tree (parentCommentId / replyLevel / rootCommentId).

## `maxCommentsPerVideo` (type: `integer`):

Comment cap per video (1-500). Deep pagination fetches up to this many threads.

## `maxRepliesPerComment` (type: `integer`):

Reply cap per top-level comment (0-500). 0 disables reply fetching.

## `maxVideosPerChannel` (type: `integer`):

How many of the channel's latest videos to monitor (1-20).

## `maxVideosPerSearch` (type: `integer`):

How many of the top search results to fetch comments for (1-10).

## `onlyNew` (type: `boolean`):

Return only comments you have not seen in earlier runs. Seen comments are skipped and never charged. Run daily to monitor a channel or brand.

## `outputFormat` (type: `string`):

full: all fields. minimal: a compact subset (id, author, text, dates, counts, route).

## `proxyMode` (type: `string`):

auto (default): direct connection first, residential proxy fallback if blocked. none: direct only. residential: always use the residential proxy.

## `searchTerms` (type: `array`):

Keywords to search on YouTube. The top matching videos are found and their comments are fetched. Video discovery always uses the InnerTube search endpoint; comment fetching follows the selected route.

## `sortBy` (type: `string`):

newest: newest first (best for monitoring). top: top comments first.

## `stateStoreName` (type: `string`):

Key-value store holding the seen-comments state for onlyNew mode. Use a different name per monitored target to keep states separate.

## `videoUrls` (type: `array`):

YouTube video URLs (watch / youtu.be / shorts / live links) or bare 11-char video IDs. Comments of each video are fetched.

## Actor input object example

```json
{
  "apiKey": "",
  "channelUrls": [
    "https://www.youtube.com/@mkbhd"
  ],
  "deduplicate": true,
  "includeReplies": true,
  "maxCommentsPerVideo": 100,
  "maxRepliesPerComment": 20,
  "maxVideosPerChannel": 5,
  "maxVideosPerSearch": 3,
  "onlyNew": false,
  "outputFormat": "full",
  "proxyMode": "auto",
  "searchTerms": [
    "AI tools"
  ],
  "sortBy": "newest",
  "stateStoreName": "youtube-comments-monitor-state",
  "videoUrls": [
    "https://www.youtube.com/watch?v=_x58r9TBois"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "apiKey": "",
    "channelUrls": [
        "https://www.youtube.com/@mkbhd"
    ],
    "deduplicate": true,
    "includeReplies": true,
    "maxCommentsPerVideo": 100,
    "maxRepliesPerComment": 20,
    "maxVideosPerChannel": 5,
    "maxVideosPerSearch": 3,
    "onlyNew": false,
    "outputFormat": "full",
    "proxyMode": "auto",
    "searchTerms": [
        "AI tools"
    ],
    "sortBy": "newest",
    "stateStoreName": "youtube-comments-monitor-state",
    "videoUrls": [
        "https://www.youtube.com/watch?v=_x58r9TBois"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("commanding_hotdog/youtube-comments-monitor").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 = {
    "apiKey": "",
    "channelUrls": ["https://www.youtube.com/@mkbhd"],
    "deduplicate": True,
    "includeReplies": True,
    "maxCommentsPerVideo": 100,
    "maxRepliesPerComment": 20,
    "maxVideosPerChannel": 5,
    "maxVideosPerSearch": 3,
    "onlyNew": False,
    "outputFormat": "full",
    "proxyMode": "auto",
    "searchTerms": ["AI tools"],
    "sortBy": "newest",
    "stateStoreName": "youtube-comments-monitor-state",
    "videoUrls": ["https://www.youtube.com/watch?v=_x58r9TBois"],
}

# Run the Actor and wait for it to finish
run = client.actor("commanding_hotdog/youtube-comments-monitor").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 '{
  "apiKey": "",
  "channelUrls": [
    "https://www.youtube.com/@mkbhd"
  ],
  "deduplicate": true,
  "includeReplies": true,
  "maxCommentsPerVideo": 100,
  "maxRepliesPerComment": 20,
  "maxVideosPerChannel": 5,
  "maxVideosPerSearch": 3,
  "onlyNew": false,
  "outputFormat": "full",
  "proxyMode": "auto",
  "searchTerms": [
    "AI tools"
  ],
  "sortBy": "newest",
  "stateStoreName": "youtube-comments-monitor-state",
  "videoUrls": [
    "https://www.youtube.com/watch?v=_x58r9TBois"
  ]
}' |
apify call commanding_hotdog/youtube-comments-monitor --silent --output-dataset

```

## MCP server setup

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

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/QjybVB1wnV9LdhnNp/builds/aY4ZoFbBbkuYS4eVI/openapi.json
