# YouTube Comments Scraper — Replies, Shorts & Creator Hearts (`valev-lab/youtube-comments-scraper`) Actor

Scrape YouTube comments and replies from videos, Shorts, channels or search. Export text, likes, creator hearts, pins and author data to CSV, Excel or JSON. Filter by keyword, date or likes, detect language and monitor unseen comments. No YouTube API key. $1/1K on Free; $0.60/1K on Gold+.

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

## Pricing

from $0.60 / 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.
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

## YouTube Comments Scraper — Replies, Likes & Creator Hearts, No API Key

**Download YouTube comments and replies to CSV, Excel or JSON, with likes, creator hearts, pinned comments and public author details.** This YouTube comment extractor works with [YouTube](https://www.youtube.com) videos, Shorts, recent channel uploads and video search results. **No YouTube Data API key or Google login is required.**

Use the dataset for **sentiment research, audience insights, product feedback or lead research**. Choose top or newest comments, filter by keywords, dates and likes, or monitor comments not delivered by your workflow before. Language labels and a free summary for each video are included.

**Price:** $1.00 per 1,000 comments/replies on the Apify Free plan, down to $0.60 on Gold+. Each run adds $0.00005 at default memory. Errors, duplicates, filtered-out comments, already-seen monitor IDs and video summaries have no comment fee.

### How to download YouTube comments

1. Replace the sample URL with a video, Short or channel URL, or add a video search query.
2. Start with the four-comment sample. Increase `maxCommentsPerVideo` when the output matches your needs.
3. Choose **Top comments** or **Newest first**, and enable replies if you need conversation context.
4. Run the Actor and inspect **Comments overview** and **Video summaries**.
5. Download JSON, CSV, Excel or HTML, or retrieve the dataset through the Apify API.

The dataset contains `type: "comment"`, `type: "videoSummary"` and `type: "error"` rows. Both views select columns from that same dataset. Keep `type == "comment"` when you need a comments-only table; selecting a view does not filter row types.

#### What can you collect?

| Capability | What you get |
| --- | --- |
| **Videos and Shorts** | Public comment text, likes, reply counts, authors and direct comment links |
| **Channel comments** | Comments from the latest public uploads on a channel's Videos tab |
| **Video search** | Comments from the top videos matching each query |
| **Reply threads** | Separate reply rows linked to their top-level parent comment |
| **Creator interactions** | Explicit creator-heart and pinned-comment flags |
| **Comment filters** | Any matching keyword, published-from date, minimum likes, or creator hearts/pins |
| **Languages** | Local language labels, including English and Bulgarian; no translation API |
| **Monitoring** | Previously undelivered comment IDs from a persistent named workflow |
| **Video summaries** | Public comment total, delivered count and the ten most-liked delivered rows |

For creator profiles, subscribers and video catalogues, use our [YouTube Channel Scraper](https://apify.com/valev-lab/youtube-channel-scraper). For the words spoken in a video, captions, SRT, VTT and LLM-ready text, use our [YouTube Transcript Scraper](https://apify.com/valev-lab/youtube-transcript-scraper).

### Ready-to-use YouTube comment workflows

Choose a saved preset from the Example tasks tab, replace its example sources and adjust the result limit. Each task includes a complete starting configuration for a different research job. You can also apply these settings directly in the Input tab.

| Workflow | Best for | Starting settings |
| --- | --- | --- |
| [Export comments and replies to CSV](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-comments-export-csv) | A spreadsheet of video conversations | Video URLs; `includeReplies: true`; 100 delivered rows per video |
| [Collect a sentiment-analysis dataset](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-comments-sentiment-research) | Your own sentiment model or topic analysis | Newest comments, replies and language labels; no built-in sentiment score |
| [Find creator hearts and pinned comments](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-creator-hearts-pins) | Creator-endorsed questions, feedback and community interactions | `creatorInteractionOnly: true`; filter the two flags separately after export if needed |
| [Monitor unseen comments](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-new-comments-monitor) | Repeat audience or competitor monitoring | `monitorMode: true`; newest first; reuse a named store |
| [Find product feedback](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-product-feedback-comments) | Questions about features, price, repairs or alternatives | Review-video search queries plus product keywords |
| [Research a channel's audience](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-channel-comment-research) | Comparing questions and popular comments across uploads | Latest five uploads, up to 50 comments per video |
| [Export Shorts comments](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-shorts-comments-export) | Short-form audience research | Shorts URLs, top/newest order and optional replies |
| [Find lead-research signals](https://apify.com/valev-lab/youtube-comments-scraper/examples/youtube-comment-lead-research) | Reviewing public recommendation or switching questions | Topic searches plus phrases such as “recommend” or “alternative” |

Sentiment workflows export the text for your own analysis. Lead-research workflows return public keyword matches for review, rather than verified buyers or private contact information. Creating a saved task does not create a schedule or recurring paid run.

### How much does the YouTube comments scraper cost?

Prices use pay-per-event billing. Real cloud tests verified start/comment/reply events, free error and summary rows, skipped duplicates and spending limits. Free means the **Apify Free plan**, not zero-cost extraction.

| Event | Free | Bronze | Silver | Gold and above |
| --- | ---: | ---: | ---: | ---: |
| `apify-actor-start`, per run at default memory | $0.00005 | $0.00005 | $0.00005 | $0.00005 |
| `comment-scraped`, per comment or reply | $0.001 | $0.0009 | $0.0008 | $0.0006 |
| 1,000 delivered comments/replies | $1.00 | $0.90 | $0.80 | $0.60 |
| Video discovery, summaries, errors and duplicates | $0 | $0 | $0 | $0 |

A four-comment sample is **$0.00405 on Free**, plus one free video summary. A run returning 1,000 comments/replies is **$1.00005 Free / $0.60005 Gold+**. Run-time platform usage is included; later storage and export operations follow Apify's platform terms. See the Pricing tab for the current rates.

Set Apify's **maximum total charge** to control spending. In a cloud test, a $0.0031 cap stopped at $0.00305. Comments delivered before a later page fails keep their comment fee; the diagnostic error and summary remain free. An unavailable video generates no comment fee, while the run-start event can still apply. There is no per-video fee or separate reply surcharge.

#### Compared with Streamers and API Dojo

Public pricing checked 9 November 2026. Billing units and included allowances differ.

| Actor | Comment price per 1,000 | Other charges and scope |
| --- | ---: | --- |
| **This Actor** | **Free $1.00; Bronze $0.90; Silver $0.80; Gold+ $0.60** | $0.00005 start; no video fee; keyword/date/like filters, creator interactions, language labels and persistent monitoring |
| [Streamers YouTube Comments Scraper](https://apify.com/streamers/youtube-comments-scraper/pricing) | Free $2.00; Bronze $1.50; Silver $1.20; Gold $0.90; Platinum $0.60; Diamond $0.30 | Per returned comment |
| [API Dojo YouTube Comments Scraper](https://apify.com/apidojo/youtube-comments-scraper) | $0.50 per 1,000 additional comments | $0.001 video-query event; its listing describes approximately 20 included comments per video |

This Actor's comment rate is **50% lower than Streamers on Free**, lower through Gold, equal on Platinum and higher on Diamond. API Dojo has a lower headline comment rate. These are price comparisons, not a claim of proven reliability parity or the lowest price on every plan.

### Input example

```json
{
  "startUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"],
  "maxCommentsPerVideo": 4,
  "sortBy": "top",
  "includeReplies": true,
  "maxRepliesPerComment": 2,
  "detectLanguage": true,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

The Console sample uses four comment/reply rows for a small first run. Ordinary inputs default to 100 if you omit `maxCommentsPerVideo`. See the Input tab for all options.

| Option | Default | Meaning |
| --- | --- | --- |
| `startUrls` | Sample if no sources | Video/Short URLs, video IDs, channel URLs or handles |
| `searchQueries` | None | Top video-only search results for each query |
| `maxCommentsPerVideo` | 100 | Delivered matching unseen comments **and replies combined** per video; `0` follows available pages to the end |
| `maxVideosPerChannel`, `maxVideosPerSearch` | 10 each | Latest channel uploads or top unique videos per query |
| `sortBy` | `top` | YouTube top or newest ordering; replies retain YouTube reply order |
| `includeReplies`, `maxRepliesPerComment` | `false`, 100 | Follow replies; the reply cap counts unique replies inspected per parent; `0` follows all available replies |
| `keywords`, `dateFrom`, `minLikes` | Empty, none, 0 | Any case-insensitive substring; inclusive UTC date; minimum available likes |
| `creatorInteractionOnly` | `false` | The comment itself must have a creator heart or pin |
| `detectLanguage` | `true` | Local ISO 639-3 labels such as `eng` and `bul`; `und` for undetermined text |
| `monitorMode`, `monitorStoreName` | `false`, `youtube-comments-scraper-monitor` | Deliver IDs not saved by the named workflow before |
| `proxyConfiguration` | Apify Proxy | Datacenter first with per-request residential fallback; custom/direct/residential choices are respected |

Supported video inputs include `watch?v=`, `youtu.be`, `/shorts/`, `/live/`, `/embed/` and plain video IDs. Channel inputs include `@handles`, `/channel/UC…`, `/c/…` and `/user/…`. Channels read the **Videos tab**; paste individual Shorts URLs for Shorts comments. Playlists are outside this Actor's input contract.

### What fields does the comments API return?

| Group | Fields |
| --- | --- |
| Comment | `commentId`, `text`, `commentUrl`, `likeCount`, `replyCount` |
| Source video | `videoId`, `videoUrl`, `videoTitle`, `channelId` (uploader) |
| Public author | `authorName`, `authorHandle`, `authorChannelId`, `authorAvatar`, `isAuthorVerified`, `isChannelOwner` |
| Creator interaction | `isPinned`, `isHeartedByCreator` |
| Reply relationship | `isReply`, `parentCommentId` (top-level thread parent) |
| Time | `publishedAt`, `publishedTimeText`, `publishedAtIsApproximate`, `scrapedAt` |
| Enrichment | `language`, `isNew` (`true` for monitor results, otherwise `null`) |
| Video summary | `type: "videoSummary"`, video fields, `totalCommentCount`, `scrapedCount`, `topComments`, `status`, `paginationComplete`, `warnings` |
| Error | `type: "error"`, `source`, `videoId`, `errorCode`, `error`, optional `parentCommentId` |

Unavailable metadata is `null`. Relative publication labels become approximate UTC dates, marked by `publishedAtIsApproximate`; the original label is retained. Abbreviated counts such as `1.2K` become 1,200 and remain rounded. `topComments` ranks delivered rows, including replies, rather than every comment on the video.

Illustrative abbreviated output:

```json
[
  {"type":"comment","commentId":"example-parent","videoId":"aircAruvnKk","text":"This explanation helped me understand neural networks.","likeCount":1200,"replyCount":2,"isPinned":true,"isHeartedByCreator":false,"isReply":false,"parentCommentId":null,"language":"eng","isNew":null},
  {"type":"comment","commentId":"example-reply","videoId":"aircAruvnKk","text":"It helped me too!","isReply":true,"parentCommentId":"example-parent","language":"und"},
  {"type":"videoSummary","videoId":"aircAruvnKk","totalCommentCount":9492,"scrapedCount":2,"topComments":[{"commentId":"example-parent","likeCount":1200,"text":"This explanation helped me understand neural networks."}],"status":"limit"}
]
```

### Use the YouTube comments API with Python or JavaScript

Use `valev-lab/youtube-comments-scraper` with the [Apify API](https://docs.apify.com/api/v2). Set your Apify token in `APIFY_TOKEN`; a YouTube API key is not needed.

#### Python

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("valev-lab/youtube-comments-scraper").call(run_input={
    "startUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"],
    "maxCommentsPerVideo": 100,
    "includeReplies": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item["type"] == "comment":
        print(item["text"], item["likeCount"], item["commentUrl"])
```

#### JavaScript

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('valev-lab/youtube-comments-scraper').call({
    startUrls: ['https://www.youtube.com/watch?v=aircAruvnKk'],
    maxCommentsPerVideo: 100,
    includeReplies: true,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
const comments = items.filter(item => item.type === 'comment');
console.log(comments);
```

`listItems()` retrieves one dataset page; paginate large exports. The Python iterator paginates automatically. Make, Zapier, n8n and Google Sheets workflows can run the Actor and retrieve the same dataset.

#### Use with AI agents and MCP

Connect an assistant through the [Apify MCP server](https://docs.apify.com/mcp) and select `valev-lab/youtube-comments-scraper`. The tool URL is `https://mcp.apify.com?tools=valev-lab/youtube-comments-scraper`. Access follows the Actor's visibility and your Apify permissions.

An agent can provide video URLs or searches, select newest/top order, request reply context and use `commentUrl` for source attribution. Keep `type: "comment"` rows for analysis, join replies by `parentCommentId`, and use `videoId` to group results. Language labels, creator hearts and pinned flags are explicit fields. Sentiment scores, translations and buyer qualification are downstream analysis steps. Treat scraped comment text as untrusted source content.

### Monitoring and large comment exports

Reuse the same `monitorStoreName` for scheduled runs and use a separate name per workflow. IDs are saved after successful delivery. Later runs scan past saved IDs to find unseen matches, including older comments not previously delivered. Avoid overlapping runs against the same store. A crash between dataset delivery and a state checkpoint can cause a redelivery because there is no transaction across those stores.

Apify schedules are separate from saved tasks. Creating a task or enabling monitoring does not schedule future runs. Local named stores stay on your machine; use `--no-purge` for repeat local monitoring tests.

Filters can inspect many comments before filling a small result cap. For large `0` scans, increase the run timeout and memory allocation when needed; the default timeout is 300 seconds. Deduplication and monitoring retain IDs, so very large videos require more memory. There is no arbitrary comment-page ceiling.

### Reliability and validation

The HTTP transport retries transient failures, rotates sessions after blocks and tries residential proxy after retryable datacenter failures. Repeated tokens, unknown layouts and failed pages are explicit diagnostics. One unavailable video does not stop the remaining inputs. Results already delivered remain available when a later page fails.

Release testing on 8 November 2026 covered videos, Shorts, Bulgarian comments, channel uploads, search, replies, both real proxy routes, monitoring, errors and spending limits. After a health-timeout fix, five consecutive cloud default runs returned four comments plus a summary in **3.062–5.397 seconds** at **256 MB**. The 500-row viral/replies case took **114.666 seconds**; this is a measurement, not a speed guarantee. These tests do not establish sustained 99% reliability or parity with another service.

### FAQ

#### How do I export YouTube comments to CSV or Excel?

Run the Actor with your URLs, then choose a dataset download format. The Comments overview selects useful columns. Keep rows where `type` is `comment` for a comments-only table; free summary and error rows use other types.

#### Can I scrape all YouTube comments and replies?

Set `maxCommentsPerVideo: 0`, `includeReplies: true` and `maxRepliesPerComment: 0`. The Actor follows the continuations YouTube exposes until the end, spending limit, timeout or explicit request failure. Deleted, held-for-review and private comments are not accessible.

#### What is the difference between top and newest comments?

Top uses YouTube's featured-comment ordering, which can expose fewer comments. Newest requests the newest-comment stream. Use newest when broad public coverage matters; neither can recover content YouTube does not expose.

#### Can I get creator hearts and pinned comments?

Yes. Set `creatorInteractionOnly: true` to keep either flag, then filter `isHeartedByCreator` or `isPinned` after export for just one category. Replies do not inherit a parent's heart or pin.

#### Can I scrape comments from an entire YouTube channel?

Yes. Paste a channel URL and set `maxVideosPerChannel`. The Actor reads recent Videos-tab uploads and applies `maxCommentsPerVideo` separately to each video. Use the companion Channel Scraper for a full video catalogue and creator statistics.

#### Does this perform YouTube comment sentiment analysis?

It collects the text, languages and metadata for your sentiment or topic-analysis pipeline. It does not calculate sentiment scores, summarize opinions or translate comments. The sentiment preset prepares a dataset for your own model.

#### How do I monitor new YouTube comments?

Enable `monitorMode`, keep the same named store and schedule repeat runs separately. New means not delivered by that workflow before; it can include older unseen comments. Successfully saved IDs are skipped on subsequent runs.

#### How accurate are comment dates, likes and languages?

Relative dates such as “2 weeks ago” are estimates, with average-length months/years and midnight UTC for day-only dates. Abbreviated likes are rounded. Local language detection uses three-letter codes, including `eng` and `bul`; short or ambiguous text can be `und` or misclassified.

#### What happens when comments are disabled or a video is private?

The video gets a free diagnostic error and summary, and other videos continue. Errors include `COMMENTS_DISABLED`, `PRIVATE`, `UNAVAILABLE` and request/shape errors. No comment fee is generated for a video that delivers no comments; the run-start event can still apply.

#### Can I use the scraper on the Apify Free plan?

Yes, subject to available credits and current [Apify plan terms](https://apify.com/pricing). The Free-tier rate is $0.001 per delivered comment/reply plus the run-start event. Free plan does not mean unlimited free extraction.

#### Does lead discovery reveal private emails or guarantee buyers?

No. It returns public comment text, author channels and source links matching your keywords. Review the context to assess relevance. It does not unlock private contact details, qualify buyers or send outreach.

#### How can I report a problem?

Use the Issues tab with a public video URL, relevant input and run ID. Use public author data appropriately and respect the target's terms and rate limits. For related video metadata or captions, see our [YouTube Channel Scraper](https://apify.com/valev-lab/youtube-channel-scraper) and [YouTube Transcript Scraper](https://apify.com/valev-lab/youtube-transcript-scraper).

# Actor input Schema

## `startUrls` (type: `array`):

Paste video or Shorts URLs, channel URLs/handles or video IDs. Start with the prefilled sample, then replace it with your own YouTube sources.

## `searchQueries` (type: `array`):

Find videos by topic or product name and collect their comments. Each query uses the top video-only search results, up to maxVideosPerSearch.

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

Latest public uploads from the shared channel Videos tab.

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

Top unique video results per query.

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

Maximum delivered matching comments and replies combined per video. Default: 100; the Console sample uses 4. Set 0 to follow all available continuations, subject to budget and timeout.

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

Use YouTube server sorting. Replies retain YouTube reply order.

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

Traverse reply continuations, including replies whose parent is filtered out.

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

Maximum unique replies inspected per parent. 0 follows all replies; the per-video delivery cap still applies.

## `detectLanguage` (type: `boolean`):

Add a language label without an API call. Codes include eng (English) and bul (Bulgarian); short or uncertain text may return und.

## `keywords` (type: `array`):

Keep comments containing any of these phrases, ignoring case. Filters can require more pages to fill a result limit.

## `dateFrom` (type: `string`):

Inclusive YYYY-MM-DD. Relative publication times are approximate.

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

Only return comments with at least this many likes. Abbreviated counts are rounded.

## `creatorInteractionOnly` (type: `boolean`):

Keep comments explicitly hearted or pinned by the creator.

## `monitorMode` (type: `boolean`):

Keep successfully delivered comment IDs per video in a named store; reuse the name on later runs.

## `monitorStoreName` (type: `string`):

Named persistent KeyValueStore. Use one per workflow and avoid overlapping runs.

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

Datacenter first, residential fallback per failed request. Explicit direct/custom/residential choices are respected.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "searchQueries": [],
  "maxVideosPerChannel": 10,
  "maxVideosPerSearch": 10,
  "maxCommentsPerVideo": 4,
  "sortBy": "top",
  "includeReplies": false,
  "maxRepliesPerComment": 100,
  "detectLanguage": true,
  "keywords": [],
  "minLikes": 0,
  "creatorInteractionOnly": false,
  "monitorMode": false,
  "monitorStoreName": "youtube-comments-scraper-monitor",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

All mixed row types as JSON. Filter type=comment for comments and replies only.

## `comments` (type: `string`):

Comment-oriented columns of the same mixed dataset. This view does not filter row types.

## `summaries` (type: `string`):

Video-summary columns of the same mixed dataset. Keep type=videoSummary for summaries only.

## `summary` (type: `string`):

Run counts, HTTP body-byte measurements and estimated event costs; not a billing invoice.

# 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 = {
    "startUrls": [
        "https://www.youtube.com/watch?v=aircAruvnKk"
    ],
    "maxCommentsPerVideo": 4
};

// Run the Actor and wait for it to finish
const run = await client.actor("valev-lab/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 = {
    "startUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"],
    "maxCommentsPerVideo": 4,
}

# Run the Actor and wait for it to finish
run = client.actor("valev-lab/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 '{
  "startUrls": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "maxCommentsPerVideo": 4
}' |
apify call valev-lab/youtube-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,valev-lab/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/QmmgINhEk488pPPvn/builds/xFWPdrhTGG6EKNGV6/openapi.json
