# YouTube Video & Comments Scraper — No API Key Needed (`axery/youtube-video-comments-scraper`) Actor

Scrape YouTube video details and top-level comments - views, likes, description, upload date, comment text, author, likes and reply counts. No login, no API key.

- **URL**: https://apify.com/axery/youtube-video-comments-scraper.md
- **Developed by:** [Axery](https://apify.com/axery) (community)
- **Categories:** Social media, News, Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.67 / 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## YouTube Video & Comments Scraper

Scrapes YouTube video details and top-level comments through YouTube's own internal API — the exact calls the watch page itself makes to render the page you see. No login, no API key, no quota.

Useful for social listening, sentiment research, video-performance tracking, and comment moderation research.

### Two modes

- **Video details** — title, channel, view count, like count, upload date, description, category, thumbnail.
- **Comments** — one row per top-level comment: text, author, like count, reply count, pinned status, relative publish time.

### What makes this different

**Real engagement numbers, not just view count.** Most lightweight YouTube scrapers stop at what the RSS/oEmbed feeds expose — title and view count. This one gets the actual like count (both video-level and per-comment), by working through YouTube's InnerTube API the same way the page's own JavaScript does.

**A join that most scrapers get wrong or skip.** YouTube's comment data isn't one clean nested object anymore — a comment's text/author and its like/reply counts are two different-looking keys on the same view model, and one of them (`toolbarStateKey`) looks exactly like a legitimate path to the counts but actually only carries whether *the current anonymous viewer* liked the comment, never a count. Reading through that key instead of the correct one returns rows that parse cleanly but are silently empty on every single like/reply figure. This Actor was built and verified against that exact trap.

**Abbreviated counts are expanded.** YouTube ships `"305K likes"` as display text, not a number. Both video-level and comment-level like counts are parsed into real integers ready to sort and sum.

**Honest scope on replies.** `reply_count` tells you how many replies a comment has, but this Actor does not walk into nested reply threads — that's a deliberately separate, heavier operation this Actor doesn't silently attempt and then under-deliver on.

### Input

| Field | Type | Notes |
|---|---|---|
| `mode` | enum | `video` or `comments`. |
| `videos` | array | Full URLs (watch/youtu.be/shorts) or bare 11-character IDs. |
| `maxItems` | integer | Comments per video. `0` walks every page available. |
| `proxyConfiguration` | object | Not normally needed. |

### Output

```json
{
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channel_name": "Rick Astley",
  "view_count": 1807600697,
  "like_count": 19000000,
  "published_at": "2009-10-25",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
```

```json
{
  "text": "can confirm: he never gave us up",
  "author_name": "@YouTube",
  "like_count": 305000,
  "reply_count": 963,
  "is_pinned": true,
  "published_time_display": "1 year ago"
}
```

A video that's private, age-restricted, or removed fails with a clear message rather than returning an empty or wrong row. Each run also writes a `RUN_COVERAGE` record to the key-value store with what was requested, what came back, and any per-video failures.

### Local development

```bash
pip install -r requirements.txt
python test_local.py --mode video dQw4w9WgXcQ
python test_local.py --mode comments dQw4w9WgXcQ --max 120 --out sample_output.json
```

`sample_output.json` is real output from a live run: one video-detail row plus 15 comments.

# Actor input Schema

## `mode` (type: `string`):

`Video details` returns one row per video with metadata. `Comments` returns one row per top-level comment.

## `videos` (type: `array`):

Full YouTube URLs (watch, youtu.be, shorts) or bare 11-character video IDs. Each is fetched independently into the same dataset.

## `maxItems` (type: `integer`):

Comments mode only. `0` walks every page YouTube offers for that video. Ignored in video-details mode, which always returns exactly one row.

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

Not normally needed - this reads the same public watch page and internal API any browser uses to play the video.

## Actor input object example

```json
{
  "mode": "video",
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Video metadata rows or comment rows, depending on the selected mode.

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

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

# Run the Actor and wait for it to finish
run = client.actor("axery/youtube-video-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 '{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxItems": 100
}' |
apify call axery/youtube-video-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,axery/youtube-video-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/sxIGEGWSr8LnOYSzn/builds/XQBMzSKlv9xZZTBwZ/openapi.json
