# Youtube Community Comments (`beautifulscrape/youtube-community-comments`) Actor

Scrape Comments from Youtube Posts. YouTube Community Comments Scraper built for high-speed, large-scale comment extraction. Collect comments, replies, and engagement data from posts with unbeatable performance and value. Only 0.01$ for 1000 comments

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

## Pricing

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

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 Community Comments Scraper?

YouTube Community Comments Scraper lets you extract all comments from YouTube community posts, 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 your community responds to posts
**Track discussions**: monitor comment threads, replies, and conversation patterns across multiple community posts
**Gather feedback**: collect all comments from community posts 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 post has.

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

📝 **Comment ID** (cid) - Unique identifier for each comment

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

👤 **Author information** - Display name, channel ID, and avatar photo URL

⏰ **Timestamp** - Relative time (e.g., "2 hours ago") and parsed Unix timestamp

👍 **Votes** - Number of likes/upvotes the comment received

💬 **Replies** - Count of replies to the comment

🖼️ **Author photo** - Profile picture URL of the comment author

❤️ **Heart status** - Whether the comment has been hearted by the post author

🔗 **Reply indicator** - Whether the comment is a reply to another comment

💰 **Paid promotion** - If applicable, information about paid promotion

📋 **Post ID** - The community post ID this comment belongs to

### Features

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

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

**Flexible input**: process multiple posts in one run

**Sorting options**: choose to sort comments by most popular or most recent

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

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

**Language support**: specify language preferences for localized content

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

**Rate limiting**: configurable delays between requests to respect YouTube's servers

### ⬇️ Input

The input for YouTube Community Comments Scraper should be a list of post IDs. You can also configure sorting preferences, language, and request delays. You can set up the input programmatically or use the fields in the Actor's interface.

#### Post IDs

You can provide one or more post IDs using the `postIds` array to process multiple posts in a single run.

**Finding a post ID**:

Using [Youtube community posts scrapper](https://apify.com/beautifulscrape/youtube-posts-scraper) you could get the list of posts ids in a channel.
Alternatively, the post ID can be extracted from a YouTube community post URL. For example, from `https://www.youtube.com/post/UgkxIzAw5jphd6edxta6g-cd3ir146kUQVef`, the post ID is `UgkxIzAw5jphd6edxta6g-cd3ir146kUQVef`.

#### Input Parameters

**Required:**
- `postIds` (array) - The YouTube community post IDs to scrape comments from

**Optional:**
- `sortBy` (integer, default: 1) - Sort order for comments:
  - `0` = Sort by most popular
  - `1` = Sort by most recent
- `language` (string) - Language code for localized content (e.g., "en", "es", "fr")
- `sleep` (float, default: 0.1) - Delay in seconds between API requests to avoid rate limiting

#### Example Input

```json
{
  "postIds": [
    "UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_",
    "UgkxAnotherPostId1234567890"
  ],
  "sortBy": 1,
  "language": "en",
  "sleep": 0.1
}
````

### ⬆️ 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 post ID, author, votes, time, or other fields.

#### JSON Output

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

```json
{
  "postUrl": "https://www.youtube.com/post/UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_",
  "postId": "UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_",
  "cid": "UgznJyxJ7tNP7wcddbB4AaABAg",
  "text": "Now he made his own anime",
  "time": "3 weeks ago",
  "author": "@RICHMasterPhily64",
  "channel": "UCI-EejXNnd_r5junsUjR1ow",
  "votes": "3",
  "replies": "",
  "photo": "https://yt3.ggpht.com/CSO8_1vYY7ijNv_nXNJvI6ei42NiIDFwZjxcTveKtnSpDrQFFODfz-sjSIjMmbldIbJtBmzQ=s88-c-k-c0x00ffffff-no-rj",
  "heart": false,
  "reply": false,
  "time_parsed": 1764579137.330339
}
```

#### Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `postUrl` | string | The full URL of the YouTube community post this comment belongs to |
| `postId` | string | The YouTube community post ID this comment belongs to |
| `cid` | string | Unique comment identifier |
| `text` | string | The comment text content |
| `time` | string | Relative time string (e.g., "2 hours ago") |
| `time_parsed` | number | Unix timestamp (if parsing successful) |
| `author` | string | Comment author's display name |
| `channel` | string | Comment author's YouTube channel ID |
| `votes` | string | Number of likes/upvotes |
| `replies` | string | Number of replies to this comment |
| `photo` | string | URL to author's profile picture |
| `heart` | boolean | Whether the comment was hearted by post author |
| `reply` | boolean | Whether this is a reply to another comment |
| `paid` | string | Paid promotion information (if applicable) |

# Actor input Schema

## `postIds` (type: `array`):

One or more Post IDs of the posts to scrape comments from.

## `sortBy` (type: `integer`):

Select the sorting order for the comments: 0 = Most popular (default), 1 = Most recent

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

Select the language for the Youtube generated text: en = English (default)

## `sleep` (type: `number`):

The sleep time in seconds between requests to avoid rate limiting.

## Actor input object example

```json
{
  "postIds": [
    "UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_"
  ],
  "sortBy": 0,
  "language": "en",
  "sleep": 0.1
}
```

# 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 = {
    "postIds": [
        "UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("beautifulscrape/youtube-community-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 = { "postIds": ["UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_"] }

# Run the Actor and wait for it to finish
run = client.actor("beautifulscrape/youtube-community-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 '{
  "postIds": [
    "UgkxtNXtLfZja5oNtwscRPb6heCzJy9kzNO_"
  ]
}' |
apify call beautifulscrape/youtube-community-comments --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Community Comments",
        "description": "Scrape Comments from Youtube Posts. YouTube Community Comments Scraper built for high-speed, large-scale comment extraction. Collect comments, replies, and engagement data from posts with unbeatable performance and value. Only 0.01$ for 1000 comments",
        "version": "1.0",
        "x-build-id": "7SaM4tR8BJ2q6mDDC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/beautifulscrape~youtube-community-comments/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-beautifulscrape-youtube-community-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-community-comments/runs": {
            "post": {
                "operationId": "runs-sync-beautifulscrape-youtube-community-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-community-comments/run-sync": {
            "post": {
                "operationId": "run-sync-beautifulscrape-youtube-community-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",
                "properties": {
                    "postIds": {
                        "title": "▶️ Post IDs",
                        "type": "array",
                        "description": "One or more Post IDs of the posts to scrape comments from.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sortBy": {
                        "title": "↕️ Sort by",
                        "minimum": 0,
                        "maximum": 1,
                        "type": "integer",
                        "description": "Select the sorting order for the comments: 0 = Most popular (default), 1 = Most recent",
                        "default": 0
                    },
                    "language": {
                        "title": "🌐 Language for Youtube generated text",
                        "type": "string",
                        "description": "Select the language for the Youtube generated text: en = English (default)",
                        "default": "en"
                    },
                    "sleep": {
                        "title": "⏳ Sleep",
                        "minimum": 0,
                        "type": "number",
                        "description": "The sleep time in seconds between requests to avoid rate limiting.",
                        "default": 0.1
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
