# YouTube Comments & Replies Reliable API (`zenomastro/youtube-comments-reliable`) Actor

Reliable YouTube comments and replies with top/newest sorting, author and engagement data, filters, proxy-aware retries and pay-per-result billing.

- **URL**: https://apify.com/zenomastro/youtube-comments-reliable.md
- **Developed by:** [Rosario Vitale](https://apify.com/zenomastro) (community)
- **Categories:** Videos, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.60 / 1,000 youtube comment or replies

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 Reliable API

Scrape public YouTube comments and replies from watch URLs, `youtu.be`, Shorts, Live, Embed URLs, or raw video IDs. Get clean comment text, author/channel details, like counts, reply counts, creator-heart status, relative publish time, and optional approximate timestamps without needing a YouTube Data API key.

### Why this Actor?

Comment scrapers often fail mid-run when YouTube changes a continuation response or blocks a cloud IP. This Actor is built around predictable batches:

- Fast direct access is tried first.
- If YouTube blocks or returns no comments, retries automatically fall back to standard Apify Proxy.
- Proxy retries use fresh sessions.
- Duplicate video IDs and comment IDs are removed.
- Invalid or comments-off videos return uncharged diagnostic rows instead of crashing the full batch.
- Billing happens only on comment/reply rows actually written to the dataset.
- The Actor stops cleanly at the user's maximum charge limit.

### Features

- Watch, `youtu.be`, Shorts, Live, Embed, and raw video-ID input
- Top comments or newest-first sorting
- Optional replies
- Per-video and global result limits
- Minimum-like filter
- Case-insensitive text filter
- Comment ID and parent-comment linkage
- Author name, channel ID/link, profile image
- Parsed integer like/reply counts
- Creator-heart flag
- Paid-comment text when YouTube exposes it
- Relative publish text exactly as returned by YouTube
- Optional approximate UTC timestamp clearly marked as approximate
- Direct-first access with optional automatic Apify Proxy fallback and custom-proxy support
- Retry/backoff with a new proxy session per attempt
- Structured, uncharged video-level failure records
- Pay only for successful comment/reply rows

### Input example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtube.com/shorts/VIDEO_ID"
  ],
  "sortBy": "top",
  "maxResultsPerVideo": 500,
  "maxTotalResults": 5000,
  "includeReplies": true,
  "minLikes": 0,
  "containsText": ""
}
```

### Output

Each successful dataset row represents one public comment or reply and includes:

- `videoId`, canonical `videoUrl`
- `commentId`, `parentCommentId`, `isReply`
- `text`
- `author`, author channel ID/link, profile image
- normalized `likeCount` and `replyCount`
- `publishedTimeText`
- `publishedAtApprox` and `publishedAtIsApproximate`
- `isHearted`
- `paidText` when available

Video-level failures use `recordType: "error"` and are not charged.

### About dates

YouTube's comment interface often returns relative time such as **"3 days ago"** instead of an absolute timestamp. This Actor preserves that source string. When the downloader can interpret it, `publishedAtApprox` is provided, but it is deliberately marked approximate rather than pretending a relative date is exact.

### Filtering

`minLikes` and `containsText` are applied before output. Filtered comments are not billed. When filters are selective, the Actor may scan more source comments than it emits, with an internal safety cap to avoid unbounded work.

### Reliability and proxies

The Actor uses **direct-first mode** because direct Apify cloud access can be much faster when YouTube accepts the request. If the first attempt is blocked or returns no comments, retries automatically switch to standard Apify Proxy. The Actor does **not** force residential proxy traffic.

You can disable automatic fallback or provide an explicit custom/Apify proxy configuration. Proxy retries use fresh sessions. Network requests use bounded timeouts, and continuation retries use short backoff rather than waiting indefinitely.

### Pricing

Target Store price: **$0.0006 per successfully emitted comment or reply** — about **$0.60 per 1,000 results** — plus the small Actor-start event shown in the Store pricing panel.

Error records, filtered-out comments, retries, and duplicate inputs do not trigger the comment event charge.

This price sits between newer low-cost competitors around $0.40–$0.50 per 1,000 and the established high-usage Actor around $0.90 per 1,000, while adding stronger failure handling, spend controls, proxy rotation, filters, normalized engagement counts, and explicit date-quality semantics.

### Limits

- Maximum 100 input videos per run
- Maximum 10,000 emitted rows per video
- Maximum 100,000 emitted rows per run
- Public comments only
- No account/login bypass
- Deleted/private content is not bypassed

Use scraped public data in accordance with applicable platform terms, copyright, privacy, and data-protection rules.

### Support

For a reproducible issue, include the public video URL, sort mode, proxy setting, and Apify run ID. Never post API tokens or private proxy credentials.

# Actor input Schema

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

Watch, youtu.be, Shorts, Live, Embed URLs, or raw 11-character IDs. Maximum 100 videos per run.

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

Top uses YouTube's ranked comments; Newest requests the most recent comments first.

## `maxResultsPerVideo` (type: `integer`):

Maximum emitted comment + reply rows for each video.

## `maxTotalResults` (type: `integer`):

Hard cap across all videos to keep runtime and spend predictable.

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

Include replies in the output. Replies use the same per-result price as top-level comments.

## `language` (type: `string`):

Language code for YouTube-generated labels, for example en, it, es, de.

## `minLikes` (type: `integer`):

Only emit comments with at least this many parsed likes. Set 0 to disable.

## `containsText` (type: `string`):

Optional case-insensitive substring filter. Filtered comments are not charged.

## `requestTimeoutSecs` (type: `integer`):

Maximum seconds for each YouTube HTTP request.

## `retries` (type: `integer`):

Retry blocked or temporary failures with a fresh proxy session.

## `autoProxyFallback` (type: `boolean`):

Try direct access first for speed, then switch retries to standard Apify Proxy if YouTube blocks or returns no comments.

## `proxyConfiguration` (type: `object`):

Optional explicit proxy configuration. Leave disabled to use fast direct-first mode with automatic proxy fallback.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "sortBy": "top",
  "maxResultsPerVideo": 500,
  "maxTotalResults": 5000,
  "includeReplies": true,
  "language": "en",
  "minLikes": 0,
  "containsText": "",
  "requestTimeoutSecs": 25,
  "retries": 2,
  "autoProxyFallback": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("zenomastro/youtube-comments-reliable").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("zenomastro/youtube-comments-reliable").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 '{}' |
apify call zenomastro/youtube-comments-reliable --silent --output-dataset

```

## MCP server setup

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

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/ozzGaT1gcHLb0qhn5/builds/dcnijajf6X8je1Nz4/openapi.json
