# YouTube Video Comments Scraper (`beautifulscrape/youtube-comments`) Actor

Extract YouTube video comments without API limits or quotas. Scrape comment text, author, vote count, reply count, creator hearts, and video metadata from one or multiple YouTube videos. Filter by date, sort by newest or top comments, and download results in JSON, CSV, or Excel.

- **URL**: https://apify.com/beautifulscrape/youtube-comments.md
- **Developed by:** [Beautiful Scrape](https://apify.com/beautifulscrape) (community)
- **Categories:** AI, SEO tools, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## What is YouTube Video Comments Scraper?

YouTube Video Comments Scraper lets you extract all comments from YouTube videos, helping you analyze audience engagement, track discussions, and gather feedback with just a few clicks.

**Analyze audience engagement**: extract comment text, author information, votes, and reply counts to understand how viewers respond to videos
**Track discussions**: monitor comment threads, replies, and conversation patterns across multiple videos
**Gather feedback**: collect all comments from videos to analyze sentiment, identify common questions, or track trending topics
**Support research**: extract structured comment data for academic research, market analysis, or content strategy development
**Automate comment collection**: replace manual comment gathering with repeatable workflows that keep datasets fresh and consistent

The scraper bypasses YouTube's interface limitations by directly accessing the comment API, allowing you to extract all comments including nested replies, regardless of how many comments a video has.

### What data does YouTube Video Comments Scraper extract?

👤 **Author** - The username/display name of the comment author

💬 **Comment** - The text content of the comment

📝 **Comment ID** (cid) - The unique comment ID assigned by YouTube

💬 **Reply Count** - The number of replies to this comment

🔗 **Reply To CID** - The comment ID this comment is replying to, null if it's a top-level comment

👍 **Vote Count** - The number of likes/upvotes the comment has received

👑 **Author Is Channel Owner** - Whether the comment author is the owner of the video's channel

⏰ **Published Time Text** - The relative time text when the comment was published (e.g., "2 days ago")

🏷️ **Type** - The type of comment - either a top-level "comment" or a "reply" to another comment

❤️ **Has Creator Heart** - Whether the video creator has "hearted" this comment

🆔 **Video ID** - The unique YouTube video ID that this comment belongs to

🎬 **Page URL** - The full URL of the YouTube video page

🔢 **Comments Count** - The total number of comments on the video

📺 **Title** - The title of the YouTube video

### Features

For maximum usefulness, YouTube Video Comments Scraper has the following abilities:

**Extract everything**: comments, replies, author details, engagement metrics, and timestamps

**Flexible input**: process multiple videos in one run using URLs

**Comment limit**: control how many comments to scrape per video with `maxComments`

**Sorting options**: choose to sort comments by top comments or newest first

**Date filtering**: scrape only comments published after a specific date with `oldestCommentDate`

**Automatic pagination**: handles all comment pages and nested replies automatically

**Error resilience**: continues processing remaining videos even if one fails

**Structured output**: export data in JSON format with consistent schema for easy analysis

### ⬇️ Input

The input for YouTube Video Comments Scraper should be a list of video URLs. You can also configure the maximum number of comments, sorting preferences, and date filters. You can set up the input programmatically or use the fields in the Actor's interface.

#### Start URLs

You can provide one or more YouTube video URLs using the `startUrls` array to process multiple videos in a single run. Each entry should be an object with a `url` field. You can also import a CSV file or Google Sheet with a list of URLs.

**Supported URL formats**:
- Standard: `https://www.youtube.com/watch?v=VIDEO_ID`
- Shorts: `https://www.youtube.com/shorts/VIDEO_ID`
- Short link: `https://youtu.be/VIDEO_ID`

#### Input Parameters

**Required:**
- `startUrls` (array) - YouTube video URLs to scrape comments from

**Optional:**
- `maxComments` (integer, default: 1) - Limit the number of comments you want to scrape per video
- `sortCommentsBy` (string, default: "NEWEST_FIRST") - Select YouTube sorting parameter for comments:
  - `"TOP_COMMENTS"` = Sort by top comments
  - `"NEWEST_FIRST"` = Sort by newest first
- `oldestCommentDate` (string) - Only comments published after or on this date will be scraped. Alternatively, specify how old the scraped comments should be. Putting "1 day" will get you only today's comments, "2 days" - yesterday's and today's, and so on. Note that if you select this, sorting parameter will be auto-reset to newest first.

#### Example Input

```json
{
  "startUrls": [
    { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
  ],
  "maxComments": 100,
  "sortCommentsBy": "NEWEST_FIRST"
}
````

#### Example Input with Date Filter

```json
{
  "startUrls": [
    { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
  ],
  "maxComments": 100,
  "oldestCommentDate": "2026-03-01"
}
```

### ⬆️ Output

The results will be wrapped into a dataset which you can find in the Output or Storage tab. Note that the output is organized in tables and tabs for viewing convenience. You can view results as a table, JSON, or other formats.

Once the run is finished, you can also download the dataset in various data formats (JSON, CSV, Excel, XML, HTML). Before exporting, you can pick or omit specific output fields.

#### Table View

The table view displays all comments with their associated metadata. You can sort by video ID, author, votes, time, or other fields.

#### JSON Output

Here's an example of the data structure for a single comment:

```json
{
  "author": "@ExampleUser",
  "comment": "This is a great video! Thanks for sharing.",
  "cid": "UgxAbCdEf12GhIjKl34MnOpQrStUvWx",
  "replyCount": 5,
  "replyToCid": null,
  "voteCount": 15,
  "authorIsChannelOwner": false,
  "publishedTimeText": "3 days ago",
  "commentType": "comment",
  "hasCreatorHeart": false,
  "videoId": "dQw4w9WgXcQ",
  "pageUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "commentsCount": 1250,
  "videoTitle": "Example Video Title"
}
```

#### Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `author` | string | null | The username/display name of the comment author |
| `comment` | string | null | The text content of the comment |
| `cid` | string | null | The unique comment ID assigned by YouTube |
| `replyCount` | number | null | The number of replies to this comment |
| `replyToCid` | string | null | The comment ID this comment is replying to, null if it's a top-level comment |
| `voteCount` | number | null | The number of likes/upvotes the comment has received |
| `authorIsChannelOwner` | boolean | null | Whether the comment author is the owner of the video's channel |
| `publishedTimeText` | string | null | The relative time text when the comment was published (e.g., "2 days ago") |
| `commentType` | string | null | The type of comment - either a top-level "comment" or a "reply" to another comment |
| `hasCreatorHeart` | boolean | null | Whether the video creator has "hearted" this comment |
| `videoId` | string | null | The unique YouTube video ID that this comment belongs to |
| `pageUrl` | string | null | The full URL of the YouTube video page |
| `commentsCount` | number | null | The total number of comments on the video |
| `videoTitle` | string | null | The title of the YouTube video |

# Actor input Schema

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

Enter a link to a specific YouTube video. You can also import a CSV file or Google Sheet with a list of URLs.

## `maxComments` (type: `integer`):

Limit the number of comments you want to scrape per video.

## `sortCommentsBy` (type: `string`):

Select YouTube sorting parameter for comments.

## `oldestCommentDate` (type: `string`):

Only comments published after or on this date will be scraped. Alternatively, specify how old the scraped comments should be. Putting 1 day will get you only today's comments, 2 days - yesterday's and today's, and so on. Note, that if you select this, sorting parameter will be auto-reset to newest first.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "maxComments": 1,
  "sortCommentsBy": "NEWEST_FIRST"
}
```

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

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

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ]
}' |
apify call beautifulscrape/youtube-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=beautifulscrape/youtube-comments",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Video Comments Scraper",
        "description": "Extract YouTube video comments without API limits or quotas. Scrape comment text, author, vote count, reply count, creator hearts, and video metadata from one or multiple YouTube videos. Filter by date, sort by newest or top comments, and download results in JSON, CSV, or Excel.",
        "version": "1.0",
        "x-build-id": "eXTxFBBdeOYwdWoBA"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/beautifulscrape~youtube-comments/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-beautifulscrape-youtube-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/beautifulscrape~youtube-comments/runs": {
            "post": {
                "operationId": "runs-sync-beautifulscrape-youtube-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/beautifulscrape~youtube-comments/run-sync": {
            "post": {
                "operationId": "run-sync-beautifulscrape-youtube-comments",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "🔗 Direct video URLs",
                        "type": "array",
                        "description": "Enter a link to a specific YouTube video. You can also import a CSV file or Google Sheet with a list of URLs.",
                        "items": {
                            "type": "object"
                        }
                    },
                    "maxComments": {
                        "title": "🔢 Maximum comments",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Limit the number of comments you want to scrape per video.",
                        "default": 1
                    },
                    "sortCommentsBy": {
                        "title": "↕️ Sorting order",
                        "enum": [
                            "TOP_COMMENTS",
                            "NEWEST_FIRST"
                        ],
                        "type": "string",
                        "description": "Select YouTube sorting parameter for comments.",
                        "default": "NEWEST_FIRST"
                    },
                    "oldestCommentDate": {
                        "title": "📅 Scrape comments published after [date]",
                        "type": "string",
                        "description": "Only comments published after or on this date will be scraped. Alternatively, specify how old the scraped comments should be. Putting 1 day will get you only today's comments, 2 days - yesterday's and today's, and so on. Note, that if you select this, sorting parameter will be auto-reset to newest first."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
