# Youtube Channel Scraper (`runtime/youtube-channel-scraper`) Actor

YouTube Channel Scraper is an Apify Actor that scrapes video data and comments from a YouTube channel. It extracts key details such as video title, URL, view count, streaming time (in days), hashtags, description, comments count, and individual comments with user IDs.

- **URL**: https://apify.com/runtime/youtube-channel-scraper.md
- **Developed by:** [scraping automation](https://apify.com/runtime) (community)
- **Categories:** Social media, Videos, Automation
- **Stats:** 108 total users, 4 monthly users, 98.1% runs succeeded, 10 bookmarks
- **User rating**: 4.18 out of 5 stars

## Pricing

$25.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## 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

## YouTube Channel & Comment Scraper – Videos, Comments, Transcripts

**Extract videos, comments & transcripts from any YouTube channel in minutes — no code.**

Scrape YouTube channel videos, comments, and transcripts with clean, structured output. Perfect for **marketers, SEO analysts, and brand-intelligence teams** who need YouTube data fast. Plug directly into Google Sheets, Zapier, Make, n8n, dashboards, or AI tools.

---

### 🚀 Getting Started (3 Steps)

1. **Provide channel URL** → Enter any YouTube channel URL (e.g., `https://www.youtube.com/@Nike`)
2. **Set max videos/comments** → Choose how many videos and comments to extract
3. **Run & export** → Get clean JSON/CSV data ready for Google Sheets, Zapier, Make, or dashboards

**Quick example (fast default run):**
```json
{
  "channel": "https://www.youtube.com/@Nike",
  "max_videos": 5,
  "video_details": true,
  "comments_max": 5
}
````

See [detailed configuration examples](#-quick-start) below.

***

### ⭐ Why Choose This Scraper?

**Key differentiators vs. cheaper alternatives:**

- **✅ Transcript extraction available** — enable `extract_transcript: true` for SEO research
- **✅ Anti-block proxy built-in** — handles large channels reliably without getting blocked
- **✅ 100+ comments per video** — extract unlimited comments with smart scrolling
- **✅ Clean, normalized data** — ready for Google Sheets, Zapier, Make, dashboards (no cleanup needed)
- **✅ Comment filtering by user** — find specific authors or brand mentions instantly

**Bottom line:** Get production-ready data in minutes, not hours of manual cleanup.

***

### 📊 How We Compare: Business-Ready vs. Budget Scrapers

| Feature | Budget Scrapers | This Scraper (Business-Ready) |
|---------|----------------|------------------------------|
| **Transcripts** | ❌ Not included | ✅ **Available** — enable `extract_transcript: true` for SEO research |
| **Comment Filtering** | ❌ All or nothing | ✅ **Filter by user/author** — find brand mentions instantly |
| **Data Quality** | ❌ Raw strings ("12K" stays "12K") | ✅ **Normalized** (12K → 12000, ISO dates) |
| **Proxy/Anti-block** | ⚠️ May break on large channels | ✅ **Built-in** — handles large channels reliably |
| **Comments per Video** | ⚠️ Limited | ✅ **100+ comments** — unlimited with smart scrolling |
| **Automation Ready** | ❌ Manual export | ✅ **Zapier, Make, n8n** — ready to integrate |
| **Export Formats** | ⚠️ JSON only | ✅ **JSON, CSV** — Google Sheets ready |
| **Time Investment** | ⏰ 2-3 hours cleanup per 1,000 videos | ✅ **Zero** — ready-to-use data |
| **Best For** | Quick one-offs, basic extraction | ✅ **Business intelligence, automation, reporting** |

#### 💰 Value Comparison

**Budget Scrapers:**

- Low upfront cost (~$0.50 per 1,000 videos)
- **Hidden cost:** 2-3 hours manual cleanup per 1,000 videos
- Missing critical features (transcripts, comment filtering)
- May break on large channels

**This Scraper:**

- Usage-based pricing
- **Zero time investment** — production-ready data
- All features included (transcripts, filtering, normalization)
- Built-in reliability for large channels

**ROI:** If your time is worth more than $25/hour, this scraper pays for itself immediately.

***

### 👥 Who It's For

**Marketers, SEO analysts, and brand-intelligence teams** who need clean YouTube data fast — without the technical headaches.

Stop wrestling with broken scrapers or spending hours on manual data collection. Get structured, ready-to-use data that integrates seamlessly with your existing tools.

***

### ⚡ Key Highlights

- **Full video info** → title, URL, views, duration, hashtags, description, links
- **Comments extraction** → filter by author, extract user IDs, unlimited comments
- **Transcript extraction** → enable `extract_transcript: true` for SEO research
- **Built-in proxy/anti-block** → handles large channels reliably
- **Automation ready** → works with Zapier, Make, n8n, Google Sheets, dashboards

***

### 🎯 Use Cases

#### SEO Research

Analyze titles, descriptions, hashtags, and engagement metrics to optimize content strategy.

#### Brand Monitoring

Detect brand mentions in comments, track reputation, and identify issues early.

#### Content Strategy

Identify top-performing videos and trending formats for data-driven decisions.

#### Competitor Analysis

Monitor competitor video strategy and performance metrics.

***

### 🔄 Automation Workflows

#### Zapier Example

1. **Trigger**: New video published on YouTube channel
2. **Action**: Run this scraper to extract video data + comments
3. **Action**: Send data to Google Sheets for analysis
4. **Action**: Send alerts to Slack if brand mentions detected

#### Make (Integromat) Example

1. **Trigger**: Scheduled run (daily/weekly)
2. **Action**: Scrape channel videos, comments, and transcripts
3. **Action**: Transform data and push to Airtable
4. **Action**: Generate report and email to team

**Ready to automate?** Export data as JSON/CSV and connect via Zapier, Make, or n8n webhooks.

#### Recommended Automation Input (v0.10)

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "max_videos": 20,
  "video_details": true,
  "comments_max": 20,
  "comments_strategy": "auto",
  "output_mode": "compact",
  "include_run_metadata": true,
  "safe_mode": true,
  "timeout": 900
}
```

- `output_mode: "compact"` keeps payloads lightweight for no-code mappers.
- `include_run_metadata: true` adds `runMeta` in each item for traceability/debugging.

#### Geo SEO Workflows

Use country/language-specific queries to monitor local intent and topics:

1. Local keyword trend monitoring by market (`US`, `FR`, `ES`, etc.).
2. Competitor gap analysis by region (same channel, different local terms).
3. Brand mention tracking by language in comments + transcript.

#### 3 Country/Language Input Templates

##### US (English) - Brand + Product Intent

```json
{
  "search_query": "\"running shoes\" review OR \"best running shoes\"",
  "max_videos": 30,
  "video_details": true,
  "comments_max": 20,
  "extract_transcript": true,
  "comments_strategy": "auto",
  "output_mode": "compact",
  "include_run_metadata": true,
  "safe_mode": true,
  "timeout": 1200
}
```

##### France (French) - SEO Local Intent

```json
{
  "search_query": "\"chaussures running\" avis OR \"meilleures chaussures running\"",
  "max_videos": 30,
  "video_details": true,
  "comments_max": 20,
  "extract_transcript": true,
  "comments_strategy": "auto",
  "output_mode": "compact",
  "include_run_metadata": true,
  "safe_mode": true,
  "timeout": 1200
}
```

##### Spain (Spanish) - Competitor + Sentiment

```json
{
  "search_query": "\"zapatillas running\" reseña OR \"mejores zapatillas running\"",
  "max_videos": 30,
  "video_details": true,
  "comments_max": 20,
  "extract_transcript": true,
  "comments_strategy": "auto",
  "output_mode": "compact",
  "include_run_metadata": true,
  "safe_mode": true,
  "timeout": 1200
}
```

#### Local Keyword Monitoring (Make / n8n)

Recommended loop:

1. Run Actor per market keyword set (`US`, `FR`, `ES`).
2. Store `id`, `title`, `published_date`, `views`, `runMeta.inputMode`, `url`.
3. Track deltas by day/week (new videos, rising views, repeated terms in title/transcript).
4. Trigger alert when competitor or brand keyword appears above your threshold.

***

### 🚀 Quick Start

**Required:** Provide either `channel`, `search_query`, or both. Enable `extract_transcript: true` to extract transcripts when `video_details: true`.

#### Channel Only

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "max_videos": 50,
  "video_details": true
}
```

#### Search Only (Global)

```json
{
  "search_query": "apple watch review",
  "max_videos": 50,
  "video_details": true,
  "comments_max": 10
}
```

#### Channel + Search

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "search_query": "air max",
  "max_videos": 50,
  "video_details": true
}
```

#### SEO Research Example (with Transcripts)

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "search_query": "air max",
  "max_videos": 50,
  "video_details": true,
  "comments_max": 50,
  "extract_transcript": true
}
```

#### Brand Monitoring Example

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "max_videos": 100,
  "video_details": true,
  "comments_max": 200,
  "comments_user_search": "nike_fan"
}
```

***

### 📥 Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `channel` | string | - | **Optional.** YouTube channel URL (e.g. `https://www.youtube.com/@Nike`). Supports @handle, /channel/ID, /c/name formats. Omit for global search with `search_query` only. |
| `search_query` | string | `""` | **Optional.** Search term. If channel provided: searches within channel. If no channel: performs global YouTube search across all videos. |
| `max_videos` | integer | `5` | Maximum number of videos to scrape (recommended: 5-10 for quick tests, 30-100 for listing, 10-30 with video\_details) |
| `video_details` | boolean | `true` | Extract full video descriptions, comments, and transcripts |
| `comments_max` | integer | `5` | Maximum comments to extract per video (recommended: 5-10 for quick tests, 10-30 for most use cases, up to 200) |
| `comments_user_search` | string | `""` | Filter comments by author name |
| `comments_strategy` | string | `"auto"` | `auto` = API then UI fallback, `api` = Innertube only, `ui` = UI only |
| `includeReplies` | boolean | `false` | Best-effort extraction of replies in UI mode |
| `extract_transcript` | boolean | `false` | Legacy switch. If true and `transcript_mode` is not set, actor uses `transcript_mode: "auto"`. |
| `transcript_mode` | string | `"auto"` | `auto` = API then UI fallback, `api` = API only, `ui` = front flow (`more` -> `transcript`), `ui_strict` = UI-only + transcript diagnostics, `off` = disable transcript. |
| `session_cookies` | array | `[]` | Optional cookie objects for authenticated YouTube session (improves transcript availability, stored as secret input). |
| `cookie_string` | string | `""` | Optional semicolon cookie string parsed as YouTube cookies (stored as secret input). |
| `output_mode` | string | `"full"` | `full` = complete payload, `compact` = automation-friendly, `minimal` = very small payload |
| `include_run_metadata` | boolean | `false` | Adds `runMeta` object per item (`actorRunId`, `startedAt`, etc.) |
| `safe_mode` | boolean | `true` | More stable navigation for large runs |
| `ui_mode` | string | `"simple"` | `simple`, `pro`, `debug` (`debug` adds screenshots/logs) |
| `timeout` | integer | `300` | Timeout in seconds (300s = 5min for quick tests, 900s = 15min for 10-20 videos with comments) |
| `useApifyProxy` | boolean | `true` | **Enabled by default.** Use Apify Proxy for reliable scraping. Recommended for large channels to avoid rate limits and blocks. Built-in anti-block protection. |
| `proxyConfiguration` | object | `{}` | Configure proxy settings: no proxy, Apify Proxy (recommended), or custom proxy URLs. Apify Proxy includes automatic IP rotation. |

**Requirements:** At least one of `channel` or `search_query` must be provided. For hard transcript cases, use `transcript_mode: "ui"` or `transcript_mode: "ui_strict"` and authenticated cookies.

#### 🔒 Proxy Configuration

**Why Use Proxies?**

- **Avoid rate limits** — YouTube may block requests from the same IP
- **Handle large channels** — Enterprise-scale scraping requires IP rotation
- **Reliability** — Built-in anti-block protection ensures consistent results

**Recommended Settings:**

- **For most users:** Keep `useApifyProxy: true` (default)
- **For large channels (100+ videos):** Use Apify Proxy with default settings
- **For enterprise use:** Configure custom proxy groups in `proxyConfiguration`

**Example Configuration:**

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "max_videos": 100,
  "video_details": true,
  "useApifyProxy": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

**Note:** Apify Proxy is included with your Apify account. No additional setup required when using default settings.

***

### ⚡ Performance Guide

#### Processing Time

- **Without video\_details**: ~1-2 seconds per video (100 videos = 3-5 minutes)
- **With video\_details**: ~30-60 seconds per video (10 videos = 5-10 minutes)

#### Configuration Examples

**Quick Overview** (100 videos, no comments): `timeout: 300`
**Brand Monitoring** (20 videos with comments): `timeout: 900`
**Deep Analysis** (10 videos, 200 comments each): `timeout: 1800`

**Pro Tip**: Use `video_details: false` first to get all video URLs quickly, then scrape specific videos with `video_details: true` for detailed analysis.

***

### 📤 Output Format

**Visual examples:**

- [Dataset JSON output](https://i.ibb.co/zVZc86kR/output.jpg) — structured data ready for analysis
- **Google Sheets** — export CSV and import directly (columns: title, views, comments, transcript, etc.)
- **Dashboards** — connect JSON output to Tableau, Power BI, or custom dashboards

**See sample output below:**

#### Video Object Structure

```json
{
  "id": "dQw4w9WgXcQ",
  "title": "Nike Air Max 2024 - Official Release",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "views": 1234567,
  "published": "2 days ago",
  "published_date": "2024-05-09",
  "duration": "10:30",
  "type": "video",
  "description": "Check out the new Nike Air Max...",
  "descriptionLinks": [
    { "text": "Shop Now", "url": "https://nike.com/airmax" }
  ],
  "transcript": "Hey everyone, welcome back...",
  "transcriptStatus": "ok",
  "likes": 12000,
  "commentCount": 523,
  "subscriberCount": 2500000,
  "channelInfo": {
    "name": "Nike",
    "url": "https://www.youtube.com/@Nike"
  },
  "videoCount": 1234,
  "isMonetized": true,
  "comments": [
    {
      "author": "nike_fan",
      "text": "Amazing product!",
      "likes": "123",
      "time": "2 days ago",
      "time_date": "2024-05-09"
    }
  ]
}
```

#### Output Features

- **Normalized views**: 1.2M → 1200000
- **ISO dates**: All dates converted to YYYY-MM-DD
- **Video types**: Automatically detected (video, short, live)
- **Structured comments**: Author, text, likes, timestamps
- **Transcript diagnostics**: `transcriptStatus` explains empty transcripts (`ok`, `disabled`, `no captionTracks`, etc.)

***

### 🛡️ Brand Safety & Comment Filtering

Use `comments_user_search` to monitor specific users or keywords:

- **Track engagement**: Find all comments from specific users
- **Detect brand mentions**: Monitor your brand or competitor names
- **Identify risks**: Find problematic content for moderation
- **AI analysis**: Export data for sentiment analysis with ChatGPT/Claude

#### Example: Brand Monitoring

```json
{
  "channel": "https://www.youtube.com/@YourBrand",
  "video_details": true,
  "comments_max": 500,
  "comments_user_search": "competitor_name"
}
```

***

### 🔧 Technical Details

#### Performance Optimizations

- Resource blocking (images, stylesheets, fonts) → 3x faster
- Smart scrolling with efficient wait mechanisms
- Incremental dataset pushes
- Configurable timeouts & retry logic

#### Data Processing

- Automatic mobile URL conversion
- View count parsing (K, M, B formats)
- Relative → absolute date conversion
- Comment pagination via YouTube's API

#### Proxy Support

- **Full Apify Proxy integration** — enabled by default (`useApifyProxy: true`)
- **Custom proxy configuration** — configure via `proxyConfiguration` parameter
- **Automatic IP rotation** — avoids rate limits and blocks
- **Enterprise-ready** — handles large channels reliably

See [Proxy Configuration](#-proxy-configuration) section above for detailed setup.

***

### 💡 Pro Tips

1. **Start small**: Test with `max_videos: 10` first
2. **Use proxies**: Enable Apify Proxy for reliable scraping
3. **Filter strategically**: Use `search_query` for relevant videos
4. **Monitor incrementally**: Run regular scrapes to track changes
5. **Combine with AI**: Export & analyze with ChatGPT/Claude

***

### 🔧 Technical Features

- **Comprehensive video data** → title, URL, views, duration, thumbnail, video type, publish date, likes, subscribers, channel info
- **Advanced comment extraction** → auto-scroll to extract 100+ comments + filter by author
- **Description links** → extract all links with text & URLs
- **Monetization detection** → detect if video has ads (`isMonetized`)
- **Global & channel search** → search YouTube globally or within channels
- **Normalized metrics** → all counts as integers (12K → 12000)
- **Optimized performance** → resource blocking, incremental pushes, smart scrolling
- **SEO-friendly output** → structured JSON with normalized data
- **Scalable & reliable** → works on large channels with retry & proxy support

***

### ⚠️ Responsible Usage

This scraper is designed for legitimate business purposes:

- Market research & competitive analysis
- Brand reputation monitoring
- Content strategy optimization
- Academic research

**Please respect YouTube's Terms of Service:**

- Do not use for spam or harassment
- Respect privacy regulations (GDPR, CCPA)
- Use proxies to avoid overwhelming servers
- Implement rate limiting for large operations

This tool is provided for research and business intelligence. Users are responsible for ensuring compliance with all applicable laws and platform policies.

***

### 📈 Get Started Today

Deploy this scraper to Apify and start extracting actionable insights from YouTube data in minutes.

**Perfect for:**

- **Marketers** tracking campaign performance and competitor content
- **SEO analysts** researching keywords, titles, and engagement patterns
- **Content strategists** identifying top-performing formats and topics
- **Brand intelligence teams** monitoring mentions and reputation

**Ready to scrape?** Use the Quick Start examples above to configure your first run. Export to Google Sheets, connect via Zapier/Make/n8n, or feed directly into your dashboards and AI tools.

***

### 🤝 Need Help?

- Report issues through the Apify Console
- Contact support via Apify's help channels
- Check out our comprehensive documentation

Your feedback helps improve this scraper for everyone!

***

**Start scraping YouTube today** — get clean, structured data that works with your tools.

# Actor input Schema

## `channel` (type: `string`):

YouTube channel URL (e.g. https://www.youtube.com/@Nike). Required unless using global search with search\_query only. Supports @handle, /channel/ID, /c/name, /user/name formats.

## `search_query` (type: `string`):

Search term. If channel provided: searches within channel. If no channel: performs global YouTube search across all videos.

## `max_videos` (type: `integer`):

Maximum number of videos to extract from the listing page. Recommended: 5-10 for quick tests, 30-100 for listing only, 10-30 when video\_details=true.

## `timeout` (type: `integer`):

Maximum runtime in seconds. Recommended: 300 (5 min) for quick tests with 5 videos, 900 (15 min) for listing only, 1800+ (30+ min) when video\_details=true with many comments.

## `video_details` (type: `boolean`):

Visit each video page to extract description, likes, comment count, comments, replies (optional), transcript (optional). Recommended: enable for comprehensive data.

## `comments_max` (type: `integer`):

Number of top-level comments to extract per video. Higher values increase processing time. Recommended: 5-10 for quick tests, 10-30 for most use cases, up to 100 for detailed analysis.

## `comments_user_search` (type: `string`):

Only keep comments whose author contains this substring (case-insensitive).

## `comments_strategy` (type: `string`):

auto = API then UI fallback, api = Innertube only, ui = UI only

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

Replies extraction is best-effort via UI fallback.

## `output_mode` (type: `string`):

full = complete payload, compact = automation-friendly without heavy text blobs, minimal = smallest payload for routing/alerts.

## `include_run_metadata` (type: `boolean`):

Adds runMeta fields (runId/taskId/startedAt/mode) to each output item for automation traceability.

## `extract_transcript` (type: `boolean`):

Legacy switch. If enabled and transcript\_mode is not set, actor uses transcript\_mode=auto.

## `transcript_mode` (type: `string`):

auto = API then UI fallback, api = captionTracks/API only, ui = front click flow (more -> transcript), ui\_strict = UI-only with extra diagnostics, off = disable transcript extraction.

## `session_cookies` (type: `array`):

Optional array of cookie objects to run in authenticated session (improves transcript availability on some videos).

## `cookie_string` (type: `string`):

Optional semicolon-separated cookies (e.g. SID=...; HSID=...). Parsed as YouTube cookies.

## `safe_mode` (type: `boolean`):

Blocks heavy resources, uses safer waits/timeouts. Recommended on large runs.

## `ui_mode` (type: `string`):

simple: quiet. pro: same behavior but intended for power users. debug: extra screenshots/logs.

## `useApifyProxy` (type: `boolean`):

Recommended.

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

Configure Apify Proxy / custom proxies.

## Actor input object example

```json
{
  "channel": "https://www.youtube.com/@Nike",
  "search_query": "",
  "max_videos": 5,
  "timeout": 300,
  "video_details": true,
  "comments_max": 5,
  "comments_user_search": "",
  "comments_strategy": "auto",
  "includeReplies": false,
  "output_mode": "full",
  "include_run_metadata": false,
  "extract_transcript": false,
  "transcript_mode": "auto",
  "safe_mode": true,
  "ui_mode": "simple",
  "useApifyProxy": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}
```

# Actor output Schema

## `allVideos` (type: `string`):

Complete dataset with all video data including metadata, comments, and transcripts

# 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 = {
    "channel": "https://www.youtube.com/@Nike",
    "useApifyProxy": true,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": []
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("runtime/youtube-channel-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 = {
    "channel": "https://www.youtube.com/@Nike",
    "useApifyProxy": True,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": [],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("runtime/youtube-channel-scraper").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 '{
  "channel": "https://www.youtube.com/@Nike",
  "useApifyProxy": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": []
  }
}' |
apify call runtime/youtube-channel-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Channel Scraper",
        "description": "YouTube Channel Scraper is an Apify Actor that scrapes video data and comments from a YouTube channel. It extracts key details such as video title, URL, view count, streaming time (in days), hashtags, description, comments count, and individual comments with user IDs.",
        "version": "0.10",
        "x-build-id": "AJmyWasolzeHCO7fK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/runtime~youtube-channel-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-runtime-youtube-channel-scraper",
                "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/runtime~youtube-channel-scraper/runs": {
            "post": {
                "operationId": "runs-sync-runtime-youtube-channel-scraper",
                "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/runtime~youtube-channel-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-runtime-youtube-channel-scraper",
                "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": {
                    "channel": {
                        "title": "Channel URL",
                        "type": "string",
                        "description": "YouTube channel URL (e.g. https://www.youtube.com/@Nike). Required unless using global search with search_query only. Supports @handle, /channel/ID, /c/name, /user/name formats."
                    },
                    "search_query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "Search term. If channel provided: searches within channel. If no channel: performs global YouTube search across all videos.",
                        "default": ""
                    },
                    "max_videos": {
                        "title": "Maximum Videos",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of videos to extract from the listing page. Recommended: 5-10 for quick tests, 30-100 for listing only, 10-30 when video_details=true.",
                        "default": 5
                    },
                    "timeout": {
                        "title": "Timeout Duration (seconds)",
                        "minimum": 60,
                        "maximum": 3600,
                        "type": "integer",
                        "description": "Maximum runtime in seconds. Recommended: 300 (5 min) for quick tests with 5 videos, 900 (15 min) for listing only, 1800+ (30+ min) when video_details=true with many comments.",
                        "default": 300
                    },
                    "video_details": {
                        "title": "Extract Video Details & Comments",
                        "type": "boolean",
                        "description": "Visit each video page to extract description, likes, comment count, comments, replies (optional), transcript (optional). Recommended: enable for comprehensive data.",
                        "default": true
                    },
                    "comments_max": {
                        "title": "Maximum Comments Per Video",
                        "minimum": 0,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Number of top-level comments to extract per video. Higher values increase processing time. Recommended: 5-10 for quick tests, 10-30 for most use cases, up to 100 for detailed analysis.",
                        "default": 5
                    },
                    "comments_user_search": {
                        "title": "Filter Comments by Author",
                        "type": "string",
                        "description": "Only keep comments whose author contains this substring (case-insensitive).",
                        "default": ""
                    },
                    "comments_strategy": {
                        "title": "Comments strategy",
                        "enum": [
                            "auto",
                            "api",
                            "ui"
                        ],
                        "type": "string",
                        "description": "auto = API then UI fallback, api = Innertube only, ui = UI only",
                        "default": "auto"
                    },
                    "includeReplies": {
                        "title": "Include Replies (UI best-effort)",
                        "type": "boolean",
                        "description": "Replies extraction is best-effort via UI fallback.",
                        "default": false
                    },
                    "output_mode": {
                        "title": "Output Mode",
                        "enum": [
                            "full",
                            "compact",
                            "minimal"
                        ],
                        "type": "string",
                        "description": "full = complete payload, compact = automation-friendly without heavy text blobs, minimal = smallest payload for routing/alerts.",
                        "default": "full"
                    },
                    "include_run_metadata": {
                        "title": "Include Run Metadata",
                        "type": "boolean",
                        "description": "Adds runMeta fields (runId/taskId/startedAt/mode) to each output item for automation traceability.",
                        "default": false
                    },
                    "extract_transcript": {
                        "title": "Extract Transcript",
                        "type": "boolean",
                        "description": "Legacy switch. If enabled and transcript_mode is not set, actor uses transcript_mode=auto.",
                        "default": false
                    },
                    "transcript_mode": {
                        "title": "Transcript Mode",
                        "enum": [
                            "auto",
                            "api",
                            "ui",
                            "ui_strict",
                            "off"
                        ],
                        "type": "string",
                        "description": "auto = API then UI fallback, api = captionTracks/API only, ui = front click flow (more -> transcript), ui_strict = UI-only with extra diagnostics, off = disable transcript extraction.",
                        "default": "auto"
                    },
                    "session_cookies": {
                        "title": "Session Cookies (advanced)",
                        "type": "array",
                        "description": "Optional array of cookie objects to run in authenticated session (improves transcript availability on some videos)."
                    },
                    "cookie_string": {
                        "title": "Cookie String (advanced)",
                        "type": "string",
                        "description": "Optional semicolon-separated cookies (e.g. SID=...; HSID=...). Parsed as YouTube cookies."
                    },
                    "safe_mode": {
                        "title": "Safe Mode (more stable)",
                        "type": "boolean",
                        "description": "Blocks heavy resources, uses safer waits/timeouts. Recommended on large runs.",
                        "default": true
                    },
                    "ui_mode": {
                        "title": "UI Mode",
                        "enum": [
                            "simple",
                            "pro",
                            "debug"
                        ],
                        "type": "string",
                        "description": "simple: quiet. pro: same behavior but intended for power users. debug: extra screenshots/logs.",
                        "default": "simple"
                    },
                    "useApifyProxy": {
                        "title": "Use Apify Proxy",
                        "type": "boolean",
                        "description": "Recommended.",
                        "default": true
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Configure Apify Proxy / custom proxies.",
                        "default": {}
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
