# YouTube Comments Scraper (`fetch_cat/youtube-comments-scraper`) Actor

Export public YouTube and Shorts comments, replies, authors, likes, creator signals, and thread metadata with keyword filters, retries, and downloadable datasets.

- **URL**: https://apify.com/fetch_cat/youtube-comments-scraper.md
- **Developed by:** [Fetch Cat](https://apify.com/fetch_cat) (community)
- **Categories:** Videos, Social media, Developer tools
- **Features:** Limited permissions
- **Stats:** 12 total users, 3 monthly users, 96.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.15 / 1,000 comment extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

Export public YouTube video and Shorts comments and replies with stable IDs, source video context, visible likes and creator signals. Apply bounded keyword, like and reply controls, then download rows for separate research or analysis. Public comment samples do not represent every viewer or comments hidden, removed or unavailable to anonymous access.

### Quick start

Choose a known public video, a small comment cap and whether replies are needed. The existing example uses a familiar video with top sorting:

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxCommentsPerVideo": 25,
  "sort": "top",
  "includeReplies": true,
  "connectionMode": "automatic"
}
```

Prefer a video guide? This short Apify walkthrough shows you how to set up and run an Actor. It uses a different Actor, but the setup steps are the same.

https://youtu.be/1OW8gOqlZbY?t=25

### Ready-to-run examples

- **[Export top YouTube video comments](https://apify.com/fetch_cat/youtube-comments-scraper/examples/export-top-youtube-video-comments)** - Start with top comments from one public video.
- **[Export YouTube comments with replies](https://apify.com/fetch_cat/youtube-comments-scraper/examples/export-youtube-comments-with-replies)** - Keep reply context for thread-level analysis.
- **[Monitor newest YouTube video comments](https://apify.com/fetch_cat/youtube-comments-scraper/examples/monitor-newest-youtube-video-comments)** - Pull newest comments for recurring monitoring.

### What you get

One saved comment or reply row with video identity, available comment ID and link, author context, text, displayed publish time and collection time. Optional pins, hearts, edited flags, badges, likes and reply counts depend on what YouTube exposes. Relative publish text is not a precise historical timestamp, and badges are source signals rather than independent identity verification.

### Who is it for?

- **Creators and community teams:** review questions, complaints and content ideas from selected videos.
- **Agencies and social listening teams:** prepare bounded viewer-feedback samples for client or competitor reporting.
- **Researchers:** retain comment IDs, thread context and collection times for reproducible public-conversation samples.

### How you can use the data

- **Prepare a bounded viewer-feedback sample.** Collect a small top or newest sample for the existing dQw4w9WgXcQ video and keep sort, videoId and scrapedAt beside text. Topic or sentiment summaries belong in a separate analysis step and should describe the observed sample rather than all viewers.
- **Review thread context selectively.** Enable replies with a low per-thread limit, retaining parentCommentId and isReply. Public reply counts can exceed the exposed sample, so missing rows do not establish that a conversation had no further replies.
- **Build a question or complaint review queue.** Use include/exclude keywords and minimum visible likes when relevant, keeping the scan cap explicit. A filtered empty result can reflect the work limit or matching rules rather than an absence of that topic everywhere.
- **Compare your own recurring exports.** Store commentId, videoId, runTag and scrapedAt in your destination, then deduplicate before reviewing additions. Schedules rerun the requested sources rather than providing a built-in complete comment history or automated moderation decision.

### Input settings

| Setting | JSON key | What to enter |
| --- | --- | --- |
| YouTube video URLs | `videoUrls` | Public YouTube watch, Shorts, youtu.be, or embed URLs. |
| YouTube video IDs | `videoIds` | Raw 11-character IDs when you already have them. |
| Maximum comments per video | `maxCommentsPerVideo` | Combined comment/reply cap per video and sort. |
| Maximum comments to inspect | `maxCommentsToScanPerVideo` | Scan cap per video and sort. Default is the smaller of 3× the row cap and 5,000. |
| Sort order | `sort` | `top`, `newest` or `both`. Both takes separately capped samples, which can overlap. |
| Include replies | `includeReplies` | Whether reply rows are collected with top-level comments. |
| Maximum replies per thread | `maxRepliesPerComment` | Bound reply fan-out for large threads. |
| Include/exclude keywords | `includeKeywords`, `excludeKeywords` | Case-insensitive filtering on comment text and author. |
| Minimum likes | `minLikes` | Save only comments meeting a visible-like threshold. |
| Run tag | `runTag` | Add a workflow or campaign label to each row. |
| Safe deadline | `maxRunSeconds` | Processing budget from the original run start. Does not renew on restart. |
| Connection | `connectionMode` | `automatic` uses the existing managed proxy route. `direct` has no paid fallback. |

Provide at least one video URL or ID, with up to 100 unique videos per run. Watch, Shorts, embed and youtu.be links are supported. For a top-level-only sample, turn replies off. For thread context, keep replies on and set a small reply cap. Detailed connection choices and custom proxy settings are explained in the input form.

### Output data

The existing illustrative row contains historical counts and relative dates, not a current audience measurement:

```json
{
  "videoId": "dQw4w9WgXcQ",
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoTitle": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "commentId": "Ugzge340dBgB75hWBm54AaABAg",
  "parentCommentId": null,
  "isReply": false,
  "authorName": "@YouTube",
  "authorChannelUrl": "https://www.youtube.com/@YouTube",
  "authorThumbnailUrl": null,
  "text": "can confirm: he never gave us up",
  "likeCount": 255000,
  "publishedTimeText": "1 year ago",
  "replyCount": 960,
  "sort": "top",
  "scrapedAt": "2026-06-16T14:21:28.786Z"
}
```

| Field | Description |
| --- | --- |
| `videoId` | YouTube video ID |
| `videoUrl` | Canonical YouTube watch URL |
| `videoTitle` | Public video title when exposed by YouTube |
| `commentId` | Public comment identifier when exposed by YouTube |
| `parentCommentId` | Parent comment ID for replies |
| `isReply` | Whether the row is a nested reply |
| `authorName` | Public author display name |
| `authorChannelUrl` | Public author channel URL |
| `authorThumbnailUrl` | Public author avatar image URL |
| `text` | Comment or reply text |
| `likeCount` | Visible like count when available |
| `publishedTimeText` | Relative published time shown by YouTube |
| `replyCount` | Visible reply count when available |
| `commentUrl` | Direct public URL to the comment when its ID is exposed |
| `authorChannelId` | Stable public author channel ID when exposed |
| `authorIsChannelOwner` | Whether the author owns the video channel when exposed |
| `authorIsVerified` | Whether YouTube exposes a verified-author badge |
| `isPinned` | Whether the comment is pinned when exposed |
| `isEdited` | Whether the visible timestamp indicates an edited comment |
| `hasCreatorHeart` | Whether the creator-heart signal is exposed |
| `sort` | Requested comment sort mode |
| `runTag` | Optional caller-supplied workflow label |
| `scrapedAt` | ISO timestamp when the row was saved |

#### Download your results

Open your run's dataset, choose **Export** and select JSON, CSV or Excel. JSON keeps nested fields together. CSV and Excel are useful when you want to review the records in a spreadsheet.

See [Apify's download and export guide](https://docs.apify.com/storage/dataset#apify-console) for the available formats and field options.

### Pricing

This Actor uses pay-per-event pricing. Input validation and durable fresh-run admission happen before the start charge. Each billed `comment` event corresponds to a row already stored in the dataset.

A fresh admitted execution charges the `start` event before extraction, even if it later returns no rows or fails. Saved public comments and replies are charged as `comment` events, including separately saved copies from overlapping top/newest samples. Nonmatching comments are not stored or charged as comment events. An abrupt interruption between storing rows, billing and saving the summary can leave saved rows with incomplete billing or summary counts. These operations are not one transaction. Reopening that execution does not reconcile uncertain charges or resume extraction.

Per-comment `comment` prices increase on every Apify plan from 27 November 2026 (16:00 UTC), with lower rates on higher subscription plans; the `start` fee is unchanged. Current prices apply until then.

See the [live Pricing tab](https://apify.com/fetch_cat/youtube-comments-scraper/pricing) for current and upcoming rates and subscription-tier discounts. Apify may also charge platform usage for compute, storage, proxies, or data transfer outside this Actor pricing.

### Tips for best results

- **Start with a short known-video sample.** Check public comment availability before increasing per-video caps.
- **Keep replies only when needed.** Use parentCommentId and isReply to retain thread context without assuming every reply was exposed.
- **Bound filtered scanning.** A scan limit can stop before enough keyword or minimum-like matches are found.
- **Keep stable comment identity.** Deduplicate recurring exports downstream by commentId and retain videoId and collection time.
- **Read summary outcomes.** Distinguish disabled or genuinely empty comments from inaccessible sources and filtered zero-row results.

### Limits and caveats

- **Public coverage only.** Hidden, removed, moderated or login-only comments cannot be returned. A playback sign-in prompt does not prevent extraction when comments remain public.
- **Bounded samples, not full archives.** Row, scan, reply and runtime limits can stop before all comments are collected. A combined ceiling of 50,000 continuation pages per video/sort includes comment and reply pages, separately from inspected-row limits and bounded request retries. Reaching that ceiling with outstanding work fails the run and preserves saved rows. Top/newest samples may overlap. Filters can legitimately leave no matching saved rows.
- **Bounded in-memory identity.** Deduplication retains fixed-size SHA-256 fingerprints of the existing comment and page-token identities, not full variable-length keys. Cryptographic collisions are negligibly unlikely, not mathematically impossible. The 512 MiB deployment also bounds V8 old-space to 320 MiB and semi-space to 8 MiB. These are heap controls, not a total process-memory guarantee.
- **New executions, not resurrection.** The deadline is measured from the original run start. Restarted, resurrected, migrated or otherwise continued executions are rejected before new extraction or charges, as are runs whose fresh admission cannot be verified. Existing output is retained. Automatic recovery is deliberately not supported. Start a **new run** for another attempt and deduplicate overlapping exports downstream.
- **Source-backed empty results.** Explicitly unavailable targets, disabled comments and reported zero comments can finish as `EMPTY_SOURCE`, with a per-input reason. Blocking and unreadable responses remain extraction errors, not proof of no comments.
- **Check completeness.** `RUN_SUMMARY` records each video/sort outcome and saved-row count. Mixed failures can leave a `PARTIAL` summary even when the platform run says succeeded. A deadline still fails the run. `BUDGET_LIMIT` stops further extraction while preserving affordable saved rows.
- **Unknown is not zero.** Visible likes, reply counts and creator signals can be missing. Relative publish text is not an exact timestamp.

#### Privacy and data handling

This Actor only requests the permissions needed to run the input you provide. It uses your input (such as URLs, search terms, identifiers, filters, and limits) only to fetch the requested public data from the relevant source site or API for this Actor, then writes results to your Apify dataset/key-value store.

Results are saved in your Apify storage. Requests may use Apify Proxy according to your connection settings. Failure diagnostics can include input with credentials removed and relevant error context so FetchCat can investigate problems. Do not submit secrets or unnecessary sensitive data in target URLs, filters or labels.

You are responsible for using this Actor lawfully, respecting the target site's terms, and avoiding unnecessary personal or sensitive data in inputs. Review the output before storing, sharing, or combining it with other data.

### Automation and integrations

#### Save your settings for next time

Once you have an input that works for you, [save it as an Apify task](https://docs.apify.com/actors/running/tasks). This keeps your settings together so you can use them again without filling in the form from scratch.

#### Run on a schedule

Need fresh results regularly? You can [schedule the Actor or a saved task](https://docs.apify.com/actors/running/schedules) to run at a time that suits you.

Each scheduled run collects the data again. If you want to compare results or highlight changes, add that step in your own workflow.

#### Send results to your other tools

Use **n8n, Make or Zapier** to connect this scraper to the rest of your workflow. For example, you could pass its results to an AI assistant or add records to a spreadsheet. Follow the [Apify integration guides](https://docs.apify.com/integrations) for your chosen tool.

For a custom connection, an [Apify webhook](https://docs.apify.com/integrations/webhooks) can notify your app when a run finishes or fails. Your app can then fetch the results or handle the failure.

### API usage

Want to collect this data from your own app or automation? The examples below send input to the scraper and show how to collect its results.

The Node.js and Python examples wait for the run to finish before reading its results. The cURL example starts the run and returns its details. Wait for that run to finish, then use its `defaultDatasetId` to fetch the results.

For setup instructions, see Apify's [JavaScript client guide](https://docs.apify.com/api/client/js), [Python client guide](https://docs.apify.com/api/client/python) and [Actor runs API reference](https://docs.apify.com/api/v2/acts-runs-post).

#### cURL

```bash
curl "https://api.apify.com/v2/acts/fetch_cat~youtube-comments-scraper/runs?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "maxCommentsPerVideo": 25,
    "sort": "top",
    "includeReplies": true
  }'
```

#### Node.js

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });

const run = await client.actor('fetch_cat/youtube-comments-scraper').call({
  videoUrls: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
  maxCommentsPerVideo: 25,
  sort: 'top',
  includeReplies: true,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient('MY-APIFY-TOKEN')

run = client.actor('fetch_cat/youtube-comments-scraper').call(run_input={
    'videoUrls': ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'],
    'maxCommentsPerVideo': 25,
    'sort': 'top',
    'includeReplies': True,
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

### MCP and AI agents

You can ask your AI assistant to collect data with **YouTube Comments Scraper** and help you work with the results. The scraper returns the data, and your assistant can then summarize it, compare records or prepare notes.

Connect your assistant through the [Apify MCP server](https://mcp.apify.com/). MCP gives your assistant a way to find this scraper, run it and read the results. Follow the [official setup and sign-in guide](https://docs.apify.com/mcp) for your app.

#### Easier setup with an Apify plugin

If you use a supported coding assistant, the [official Apify plugin](https://docs.apify.com/agents/plugins) can set up the connection for you. It connects your assistant to Apify and includes instructions for common tasks. Follow the guide for your particular app.

#### Use Apify AI in Console

Prefer to keep everything in Apify? Open [Apify AI in Console](https://docs.apify.com/account/apify-ai) and ask it to find Fetch Cat's **YouTube Comments Scraper**. You can describe the data you want and ask questions about the results.

Apify AI is currently in beta. It asks for confirmation before starting an Actor, and normal run charges apply.

#### Choose your assistant

- **Claude and Claude Code (Anthropic):** [Apify setup guide](https://docs.apify.com/integrations/claude).
- **ChatGPT and Codex (OpenAI):** [Apify setup guides](https://docs.apify.com/integrations/openai).
- **Grok Bot (xAI):** [Apify plugin guide](https://docs.apify.com/integrations/grok-bot).
- **Gemini CLI (Google):** [MCP server setup guide](https://geminicli.com/docs/tools/mcp-server/). Use the server URL below with the HTTP configuration supported by Gemini CLI.

#### Connect just this scraper

To keep your setup focused on this scraper, add this server configuration to a compatible MCP client:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=fetch_cat/youtube-comments-scraper"
    }
  }
}
```

Sign in to Apify when your client asks. If your client uses a Bearer token instead, follow its setup guide and keep the token in its secure configuration. Configuration formats vary by app, so use the linked guide if your client needs a different format.

#### Use Apify's general server

Already connected to the general Apify MCP server at `https://mcp.apify.com`? You can use it to find this scraper without adding another server. Ask your assistant to use **YouTube Comments Scraper** by Fetch Cat, or give it the identifier `fetch_cat/youtube-comments-scraper`.

Your assistant can check the available settings and retrieve the results from the returned run. If the run is still working, it should follow that run rather than start it again. Both connection options use Apify's hosted service.

#### Example requests

- “Get five top comments from Rick Astley’s Never Gonna Give You Up video, without replies. Keep their source links so I can review the sample.”
- “Retrieve five newest comments from https://www.youtube.com/watch?v=dQw4w9WgXcQ, including at most two replies per thread. Group the returned replies under their parent comments for review.”
- “From that video, inspect at most fifteen comments and return up to five mentioning music, without replies. Put the returned text and available likes into a short table, and explain if none matched.”

Normal Apify charges apply. Check the [live Pricing tab](https://apify.com/fetch_cat/youtube-comments-scraper/pricing) before asking your assistant to run a larger batch.

### Pay with x402

If your AI agent has a funded wallet, it can pay for Apify usage through [x402](https://docs.apify.com/integrations/x402). This experimental option lets an agent use Apify without a conventional account.

[Apify AGI](https://agi.apify.com/) provides a prepaid API token with a spending cap after payment. Your agent can use that token to run this scraper through the Apify API or an authenticated MCP connection.

Some MCP setups also support paying for each request directly. That is a different payment option, so check the official guide for its availability.

Follow the official guide for wallet setup, supported payment options and current terms. Apify handles the payments. Keep wallet keys and payment tokens in your agent's secure configuration.

#### Other ways for agents to pay

Apify also supports **MPP** for prepaid access through AGI and **Skyfire** for eligible Actors. If your agent already uses one of these, see the [agentic payment guide](https://docs.apify.com/agents/payments) to choose the right setup.

### FAQ

#### Can I scrape multiple videos in one run?

Yes. Add multiple video URLs or IDs to the input.

#### Can I get replies?

Yes. Enable `includeReplies` to include nested replies when YouTube exposes them.

#### Can I export to CSV?

Yes. Apify datasets can be downloaded as CSV, JSON, Excel, XML, RSS, and HTML.

#### Can I run this from code?

Yes. Use the Apify API, JavaScript client, Python client, webhooks, schedules, or MCP.

#### Does this require a YouTube account?

No. The actor is designed for public comments visible without login.

### Troubleshooting

#### Why did I get zero comments?

Check `RUN_SUMMARY` in the default key-value store. Explicitly unavailable/login-gated targets, disabled comments and sources reporting zero comments finish as `EMPTY_SOURCE`, with the source-backed reason in `outcomes`. Unknown, blocked or unreadable comment responses remain errors, not proof of an empty source. Keyword and minimum-like filters can legitimately produce zero stored rows. `BUDGET_LIMIT` means the run charge limit stopped further extraction. Saved comments remain available.

#### Why did restart or resurrection stop without extracting?

This Actor fails closed when an execution was already admitted or its fresh-run/storage history cannot be verified. Check `LIFECYCLE_DIAGNOSTIC` in its default key-value store. It preserves existing rows, original admission and summaries rather than repeating extraction or guessing whether interrupted charges completed. Start a **new run**, not a resurrection, and review the previous dataset before combining exports. A new run can incur its own start and saved-row charges. For local execution, use a new isolated storage directory for each fresh run.

#### Why are some fields null?

YouTube does not expose every field for every comment.

The actor keeps the row instead of inventing values.

#### Which connection should I choose?

Keep Automatic for the existing managed-proxy behavior, or choose Direct when you want no proxy. Direct never switches to a paid connection. Neither option guarantees access. See the input help for custom pools and settings precedence.

### Related Actors

Explore other actors by the same developer on Apify:

- [YouTube Transcript Scraper](https://apify.com/fetch_cat/youtube-transcript-scraper) — Collect available YouTube caption text and conditional timing from known video URLs.
- [YouTube Channel Videos Scraper](https://apify.com/fetch_cat/youtube-channel-videos-scraper) — Collect recent public YouTube channel video metadata, without promising a complete historical archive.
- [YouTube Shorts Scraper](https://apify.com/fetch_cat/youtube-shorts-scraper) — Collect metadata for available public YouTube Shorts.
- [YouTube Video Details Scraper](https://apify.com/fetch_cat/youtube-video-details-scraper) — Collect public YouTube video metadata and available engagement from known video URLs.
- [YouTube Channel Details Scraper](https://apify.com/fetch_cat/youtube-channel-details-scraper) — Collect public YouTube channel descriptions, identifiers and available audience counts.

### Support and feedback

For custom additions or integrations, email <hello@fetchcat.dev>.

Found an error or have a feature request? [Open an issue](https://apify.com/fetch_cat/youtube-comments-scraper/issues) with the run URL, a non-sensitive input example and what you expected.

Need help sharing it? See [Apify’s guide to sharing a run when reporting an issue](https://docs.apify.com/account/collaboration/general-resource-access#automatically-sharing-runs-via-actor-issues). Sharing a run can give the developer access to its input, logs and results, so use a run that contains no sensitive data. Please leave out API tokens, passwords, cookies, private documents and personal data. Use a public sample URL or a redacted example instead.

Tried this scraper? We'd love to hear how it worked for you. [Leave a review](https://apify.com/fetch_cat/youtube-comments-scraper/reviews) to help others choose the right tool and help us improve it. Your feedback means a lot to us.

Made with care for curious people, AI agents and the possibilities in data. ♥

# Changelog

This Actor's version history is a separate document: https://apify.com/fetch_cat/youtube-comments-scraper/changelog.md

# Actor input Schema

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

Public YouTube watch, Shorts, embed, or youtu.be URLs to scrape comments from.

## `videoIds` (type: `array`):

Optional 11-character YouTube video IDs. Use this if you already have IDs instead of full URLs.

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

Maximum combined number of comments and replies to save per video and sort. Choosing Top and newest applies this limit separately to each sort, and can return the same comment twice with different sort values.

## `maxCommentsToScanPerVideo` (type: `integer`):

Optional inspected-comment budget per video and sort for filtered runs. Must be at least the saved-row limit. When omitted, defaults to the smaller of 3 times the output limit and 5000. Increase for rare matches. Independently, at most 50000 combined comment/reply continuation pages are admitted per video and sort; outstanding work at that ceiling fails truthfully and preserves saved rows. The original run deadline and available pages can stop work earlier.

## `includeKeywords` (type: `array`):

Only save comments whose text or author contains at least one keyword. Matching is case-insensitive.

## `excludeKeywords` (type: `array`):

Skip comments whose text or author contains any listed keyword. Matching is case-insensitive.

## `connectionMode` (type: `string`):

Automatic preserves the existing managed Apify Proxy route from the first request, which can incur proxy costs. It is not a direct-first fallback. Direct makes requests without a proxy and never falls back to a paid route. Explicit proxyConfiguration settings take precedence, including custom pools and proxy opt-outs. Both choices retain the same bounded request retries and run deadline.

## `sort` (type: `string`):

Use top or newest comments when exposed by YouTube. Both runs two independent samples, each with its own row/scan cap. Overlapping comments are retained with different sort values and are billed as separate saved rows.

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

Also extract replies nested under top-level comments when available.

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

Safety cap for replies collected from any single thread. Set 0 to keep top-level comments only while leaving includeReplies enabled for reusable tasks.

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

Only save comments with at least this many visible likes.

## `runTag` (type: `string`):

Optional label copied to every output row for campaigns, schedules, or downstream joins.

## `maxRunSeconds` (type: `integer`):

Processing budget from the original run start, independent of request retries. The deployed platform timeout is 300 seconds, so keep this below that timeout with time to save the summary. A larger value does not extend the platform timeout. Restart, resurrection and other continuations fail closed without new extraction or charges; they do not reset this budget. Start a NEW run for another attempt, retaining and reviewing any previous rows because abrupt storage/billing interruptions are not automatically reconciled. Reduce the workload if the deadline is reached.

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

Optional managed groups/country, custom proxy pool or explicit useApifyProxy:false. When supplied, these settings override Connection, including its form defaults. Omit this object to use Connection. The selected pool stays in effect without substitution. A brief run notice confirms legacy settings remain active. Proxy costs depend on the selected pool and traffic.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "videoIds": [],
  "maxCommentsPerVideo": 20,
  "includeKeywords": [],
  "excludeKeywords": [],
  "connectionMode": "automatic",
  "sort": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 20,
  "minLikes": 0,
  "maxRunSeconds": 270
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "videoIds": [],
    "maxCommentsPerVideo": 20,
    "connectionMode": "automatic",
    "sort": "top",
    "includeReplies": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("fetch_cat/youtube-comments-scraper").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 = {
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "videoIds": [],
    "maxCommentsPerVideo": 20,
    "connectionMode": "automatic",
    "sort": "top",
    "includeReplies": True,
}

# Run the Actor and wait for it to finish
run = client.actor("fetch_cat/youtube-comments-scraper").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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "videoIds": [],
  "maxCommentsPerVideo": 20,
  "connectionMode": "automatic",
  "sort": "top",
  "includeReplies": true
}' |
apify call fetch_cat/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

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

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/ewFsoGkSqAiugqK8i/builds/nQG3pajx2rIvBdI4Q/openapi.json
