# YouTube Intelligence Scraper (`qaseemiqbal/youtube-intelligence-scraper`) Actor

Extract public YouTube videos, channels, playlists, Shorts, livestreams, comments, and subtitles into normalized intelligence records

- **URL**: https://apify.com/qaseemiqbal/youtube-intelligence-scraper.md
- **Developed by:** [Muhammad Qaseem Iqbal](https://apify.com/qaseemiqbal) (community)
- **Categories:** Social media, Videos, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 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

## YouTube Intelligence Scraper

YouTube Intelligence Scraper helps you collect useful public information from YouTube in a clean, organized format.

Use it to gather data from YouTube videos, Shorts, livestreams, channels, playlists, search results, hashtags, comments, and public subtitles. The Actor turns that information into structured results you can download, analyze, send to other tools, or use in AI workflows.

### What Does YouTube Intelligence Scraper Do?

This Actor collects public YouTube data such as video titles, channel names, view counts, comments, subtitles, descriptions, links, and playlist details.

You can use it to:

- Search YouTube for keywords and collect matching videos.
- Scrape a channel and see its public videos, Shorts, livestreams, and profile details.
- Extract video metadata such as title, URL, duration, publish date, views, likes, and comments count.
- Collect public comments and replies from videos.
- Download public subtitles and transcripts when they are available.
- Extract links from video and channel descriptions.
- Export results in Apify dataset formats such as JSON, CSV, Excel, XML, HTML, and RSS.
- Keep failed inputs visible with clear error rows instead of silently skipping them.

### Who Is This Actor For?

YouTube Intelligence Scraper is useful for:

- Marketing and growth teams tracking brand mentions.
- Agencies researching competitors and creators.
- YouTube SEO researchers looking for content ideas.
- Product teams studying reviews and customer feedback.
- Journalists and researchers collecting public source material.
- AI teams building transcript, summarization, classification, or RAG datasets.
- Data teams exporting YouTube results into spreadsheets, dashboards, or databases.

### Common Use Cases

| Use case | How this Actor helps |
| --- | --- |
| Brand monitoring | Track your brand, product, founder, or competitor names across titles, descriptions, transcripts, comments, and hashtags. |
| Competitor research | Compare publishing activity, views, likes, comments, Shorts usage, livestreams, and channel metadata. |
| Influencer discovery | Find creators in a niche and review their channel size, engagement, links, and content topics. |
| Product review research | Collect review videos, public comments, description links, and audience feedback. |
| Content strategy | Discover popular topics, hashtags, video lengths, title patterns, and audience response. |
| AI datasets | Export transcripts, comments, and video metadata for AI analysis, summaries, embeddings, and search. |
| Media research | Save traceable public YouTube records with source URLs and collection timestamps. |

### What Data Can You Scrape From YouTube?

| Data type | Examples |
| --- | --- |
| Video details | Title, URL, video ID, description, duration, publish date, thumbnails |
| Engagement | Views, likes when public, comments count, simple engagement rate |
| Channel details | Channel name, handle, URL, subscriber count, description, location when public |
| Search results | Search query, result rank, video/channel/playlist result type |
| Shorts | Shorts URLs and Shorts discovered from search or channels |
| Livestreams | Public live, upcoming, and past livestream metadata when available |
| Playlists | Playlist ID, playlist title, video order, playlist source URL |
| Comments | Comment text, author name, likes, reply count, parent comment ID |
| Subtitles | Public transcript text, language, subtitle type, timestamped segments |
| Links | Public links from video and channel descriptions |
| Errors | Clear error rows for missing, unavailable, private, or blocked sources |

### How To Scrape YouTube Data

1. Open the Actor in Apify Console.
2. Add at least one source:
   - YouTube URL
   - Search query
   - Channel handle
   - Hashtag
3. Choose a scraping mode, or leave it on `auto`.
4. Set how many results you want.
5. Turn on optional extras such as video details, channel details, comments, or subtitles only when you need them.
6. Start the run.
7. Open the Dataset tab to preview or download your results.

For larger runs, keep Apify Proxy enabled and start with smaller limits first.

### Input Examples

You can use the form in Apify Console or paste JSON input directly.

#### Scrape YouTube Search Results

Use this when you want to find videos around a topic.

```json
{
  "searchQueries": ["best AI automation tools"],
  "mode": "search",
  "maxResultsPerSource": 25,
  "includeVideoDetails": false,
  "includeChannelDetails": false
}
````

#### Scrape a Channel

Use this when you want to audit a creator, competitor, or brand channel.

```json
{
  "channelHandles": ["@Apify"],
  "mode": "channels",
  "channelTab": "videos",
  "maxResultsPerSource": 25,
  "includeVideoDetails": false,
  "includeChannelDetails": true
}
```

#### Scrape a Playlist

Use this when you want the videos from a course, series, music playlist, webinar archive, or collection.

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/playlist?list=PLxxxx"
    }
  ],
  "mode": "playlists",
  "maxResultsPerSource": 50,
  "includeVideoDetails": false
}
```

#### Scrape Comments

Use this when you want to analyze audience feedback.

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=VIDEO_ID"
    }
  ],
  "mode": "comments",
  "includeComments": true,
  "maxCommentsPerVideo": 100,
  "includeReplies": true,
  "maxRepliesPerComment": 5
}
```

#### Scrape Subtitles Or Transcripts

Use this when you want text from public captions for AI, research, or content analysis.

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=VIDEO_ID"
    }
  ],
  "mode": "transcripts",
  "includeSubtitles": true,
  "subtitleLanguages": ["en"],
  "subtitleFormat": "plainText",
  "includeTranscriptSegments": true,
  "saveSubtitlesToKeyValueStore": true
}
```

#### Monitor Brand Mentions

Use this as a scheduled Apify task to check YouTube search results regularly.

```json
{
  "searchQueries": ["acme software review", "acme app tutorial"],
  "mode": "search",
  "maxResultsPerSource": 25,
  "includeVideoDetails": false,
  "includeChannelDetails": false,
  "includeDescriptionLinks": true,
  "includeSubtitles": false,
  "subtitleLanguages": ["en"],
  "includeComments": false,
  "maxCommentsPerVideo": 0,
  "deduplicate": true
}
```

### Output Example

Results are saved to an Apify dataset. Think of the dataset as a table of rows you can preview, filter, and download.

Here is a simplified video result:

```json
{
  "recordType": "video",
  "videoId": "abc123XYZ00",
  "title": "Best AI Tools for Small Businesses",
  "url": "https://www.youtube.com/watch?v=abc123XYZ00",
  "channelName": "Example Tech",
  "channelHandle": "@ExampleTech",
  "viewCount": 184233,
  "likeCount": 6710,
  "commentCount": 422,
  "durationSeconds": 764,
  "publishedDate": "2026-05-21",
  "isShort": false,
  "isLive": false,
  "sourceType": "search",
  "sourceQuery": "best AI tools",
  "collectedAt": "2026-06-13T21:00:00.000Z"
}
```

Comment results use `recordType: "comment"`:

```json
{
  "recordType": "comment",
  "videoId": "abc123XYZ00",
  "commentId": "UgExampleCommentId",
  "authorName": "Public User",
  "commentText": "This was useful.",
  "commentLikeCount": 18,
  "publishedText": "2 days ago",
  "replyCount": 3,
  "replyDepth": 0,
  "collectedAt": "2026-06-13T21:00:00.000Z"
}
```

Transcript results use `recordType: "transcript"`:

```json
{
  "recordType": "transcript",
  "videoId": "abc123XYZ00",
  "language": "en",
  "subtitleType": "autoGenerated",
  "subtitleFormat": "plainText",
  "segmentCount": 245,
  "transcriptText": "Today we are looking at practical AI tools for small businesses.",
  "collectedAt": "2026-06-13T21:00:00.000Z"
}
```

### Error Items

If the Actor cannot collect data for one input, it can add an error row to the dataset instead of skipping it.

This is useful because you can see exactly what failed and why.

Example:

```json
{
  "recordType": "error",
  "input": "https://www.youtube.com/@missing-channel",
  "url": "https://www.youtube.com/@missing-channel",
  "error": "CHANNEL_DOES_NOT_EXIST",
  "note": "Channel URL points to a channel that does not exist.",
  "recoverable": true,
  "collectedAt": "2026-06-13T21:00:00.000Z"
}
```

Common error codes:

| Error | Meaning |
| --- | --- |
| `NO_VALID_START_URLS` | No valid YouTube source was provided |
| `NO_RESULTS` | The source returned no public results |
| `VIDEO_UNAVAILABLE` | The video is deleted, private, region-blocked, or otherwise unavailable |
| `AGE_RESTRICTED` | The video or channel requires age verification or login |
| `CHANNEL_DOES_NOT_EXIST` | The channel could not be found |
| `NO_COMMENTS` | No public comments were found, or comments are disabled |
| `NO_SUBTITLES` | No public subtitles were found for the requested language |
| `DATE_FILTER_TOO_STRICT` | The date filter removed all matching results |
| `BLOCKED` | YouTube or the selected proxy blocked the page before results could be collected |
| `PARSER_CHANGED` | YouTube returned a page layout the Actor could not read reliably |

### Where Are Subtitles Saved?

When subtitle saving is enabled, full subtitle files are stored in the Actor's Key-Value Store.

The dataset result includes references to those files, so you can download or reuse the full transcript later without making each dataset row too large.

### Keeping Runs Cheap

The Actor is configured for low-cost discovery by default. A normal search run collects a smaller first batch of results, skips extra video and channel page visits, blocks video media, fonts, and tracking assets, and uses modest concurrency.

For the lowest cost:

- Keep `maxResultsPerSource` close to the default `25` until you know the source is useful.
- Leave `includeVideoDetails` and `includeChannelDetails` off for broad discovery.
- Turn on comments, replies, and subtitles only for selected videos.
- Keep `maxConcurrency` near the default `2` for steadier, lower-risk runs.
- Run a small search first, then use the best video or channel URLs for a second enriched run.

### Tips For Best Results

- Start with the default low-cost settings before collecting thousands of results.
- Use `maxResultsPerSource` to control how much data you collect.
- Turn on comments only when you need comment text.
- Turn on subtitles only when you need transcripts.
- Use `includeVideoDetails: false` and `includeChannelDetails: false` for faster discovery runs.
- Keep Apify Proxy enabled for more reliable YouTube scraping.
- Lower concurrency if you see many retries or blocked requests.

### Integrations

After the Actor finishes, you can use your results with:

- Google Sheets or Google Drive
- Make
- Zapier
- n8n
- Airbyte
- Slack
- Databases and dashboards
- Apify API
- Webhooks
- Apify MCP
- AI tools such as LangChain or LlamaIndex

### FAQ

#### Can I scrape YouTube dislikes?

No. Non-public dislike counts are not available as scraped fields.

#### Can I scrape private videos?

No. This Actor only targets public YouTube data.

#### Can I scrape age-restricted videos?

Usually no. If a page requires login or age verification, the Actor returns an error item instead of trying to bypass access controls.

#### Can I scrape subtitles?

Yes, when public subtitles are available. The Actor can collect manual and auto-generated captions in formats such as plain text, SRT, WebVTT, XML, or timestamped JSON segments.

#### Can I scrape comments?

Yes. Turn on `includeComments` and set `maxCommentsPerVideo`. You can also enable replies with `includeReplies`.

#### Can I download videos?

No. This Actor is for metadata, comments, subtitles, transcripts, links, and public text data. It does not download video media by default.

#### How many results can I scrape?

The input schema allows up to `20,000` primary results per source, but real results depend on the source, YouTube availability, filters, region, language, and run settings. For very large runs, test with a smaller limit first.

#### Why do results vary between runs?

YouTube results can change based on time, location, language, ranking, video availability, and platform updates.

#### Should I use a proxy?

Yes. YouTube scraping is usually more reliable with proxy support. The default input is configured for Apify Proxy.

#### Is it legal to scrape YouTube?

Scraping public web data can be lawful, but you are responsible for using the data legally and respecting privacy, copyright, and platform rules. If you are unsure, consult a legal professional.

### Limitations

- Only public YouTube data is supported.
- Private, login-only, member-only, and paid content is not supported.
- The Actor does not bypass CAPTCHAs, age gates, paywalls, or authentication.
- Non-public dislikes are not scraped.
- Video media is not downloaded by default.
- Some counts may be rounded, hidden, delayed, or unavailable.
- Search results and comments can change over time.
- Large comment and transcript runs can take longer and use more compute.

### Troubleshooting

| Problem | Likely cause | What to try |
| --- | --- | --- |
| No results | The query is too narrow, filters are strict, or YouTube returned no public results | Increase limits, loosen filters, or try another source |
| Missing subtitles | The video has no public captions in the requested language | Try another language or disable subtitle extraction |
| Missing comments | Comments are disabled or unavailable | Try another video or disable comment extraction |
| Slow run | Comments, replies, subtitles, or deep video details are enabled | Lower limits or disable expensive options |
| Channel URL times out | YouTube was slow or blocked through the selected proxy | Try the `/videos` channel tab, keep concurrency low, increase navigation timeout, or use a stronger proxy option if your Apify account supports it |
| Parser changed error | YouTube returned an unexpected page layout or an empty channel grid | Retry with the latest build, keep Apify Proxy enabled, and try a direct `/videos` channel URL |
| Many retries | Rate limiting, blocking, or network issues | Lower concurrency and keep proxy enabled |
| Invalid source error | URL, handle, or hashtag is malformed | Check the input and run again |

### For Developers

You can run and test the Actor locally:

```bash
npm install
npm run typecheck
npm test -- --run
npm run lint
npm run build
```

Live smoke tests are available when browser and network access are intended:

```bash
RUN_INTEGRATION=1 npm test -- --run test/integration
```

# Actor input Schema

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

Video, Shorts, channel, playlist, search result, hashtag, or live URLs.

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

Search terms exactly as they would be entered in YouTube search.

## `channelHandles` (type: `array`):

Examples: @Apify, Apify, UCxxxx.

## `hashtags` (type: `array`):

Hashtags to scrape without the # symbol.

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

Choose whether to auto-detect each source type or force a specific scraping workflow.

## `maxResultsPerSource` (type: `integer`):

Maximum number of main results to collect from each URL, search query, channel, playlist, or hashtag. The default is intentionally small to keep runs cheap.

## `maxVideos` (type: `integer`):

Maximum number of regular videos to collect per source when video-type limits apply.

## `maxShorts` (type: `integer`):

Maximum number of YouTube Shorts to collect per source when Shorts are available.

## `maxStreams` (type: `integer`):

Maximum number of live, upcoming, or past livestream videos to collect per source.

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

Maximum number of top-level public comments to collect for each video when comments are enabled.

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

Maximum number of public replies to collect for each top-level comment.

## `includeVideoDetails` (type: `boolean`):

Open each video page to collect richer metadata. Leave disabled for the cheapest discovery runs.

## `includeChannelDetails` (type: `boolean`):

Open channel pages to collect public channel profile information. Leave disabled for lower-cost runs.

## `includeDescriptionLinks` (type: `boolean`):

Extract public links found in video descriptions.

## `includeSocialLinks` (type: `boolean`):

Detect common public social profile links from channel and description links.

## `includeComments` (type: `boolean`):

Collect public comments for videos.

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

Collect public replies under top-level comments when comments are enabled.

## `commentsSort` (type: `string`):

Preferred public comment ordering when the page supports it.

## `includeSubtitles` (type: `boolean`):

Collect public subtitles or transcripts when they are available.

## `subtitleLanguages` (type: `array`):

Preferred subtitle language codes, such as en, de, es, or fr.

## `subtitleFormat` (type: `string`):

Format used for saved subtitle or transcript output.

## `includeTranscriptSegments` (type: `boolean`):

Include timestamped transcript segments in transcript records.

## `saveSubtitlesToKeyValueStore` (type: `boolean`):

Save full subtitle files to Apify Key-Value Store and include references in dataset records.

## `searchSort` (type: `string`):

Preferred sorting order for YouTube search results.

## `searchDateFilter` (type: `string`):

Limit YouTube search results by approximate upload date.

## `searchType` (type: `string`):

Restrict YouTube search to videos, channels, playlists, or all supported result types.

## `durationFilter` (type: `string`):

Restrict search results by video duration when supported by YouTube.

## `features` (type: `array`):

Optional YouTube search feature filters such as live, HD, 4K, subtitles, or Creative Commons.

## `channelTab` (type: `string`):

Channel section to scrape, such as videos, Shorts, streams, playlists, about, or all supported tabs.

## `channelVideoSort` (type: `string`):

Preferred sort order for channel videos when available.

## `publishedAfter` (type: `string`):

Only include videos published on or after this date in YYYY-MM-DD format.

## `publishedBefore` (type: `string`):

Only include videos published on or before this date in YYYY-MM-DD format.

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

Preferred YouTube interface and result language.

## `countryCode` (type: `string`):

Preferred two-letter country or region code for localized YouTube results.

## `timezone` (type: `string`):

Timezone used for interpreting dates and run summaries.

## `deduplicate` (type: `boolean`):

Merge duplicate videos found from multiple sources into one canonical result.

## `dedupeKey` (type: `string`):

Field used to decide whether two video records are duplicates.

## `datasetStrategy` (type: `string`):

Choose whether to store all record types in one dataset or split them into separate datasets.

## `outputGranularity` (type: `string`):

Choose a flatter output for spreadsheets, nested output for APIs, or both.

## `errorHandling` (type: `string`):

Choose how the Actor should handle invalid sources and recoverable page errors.

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

Proxy settings used for YouTube requests. Apify Proxy is recommended.

## `minConcurrency` (type: `integer`):

Minimum number of pages processed in parallel.

## `maxConcurrency` (type: `integer`):

Maximum number of pages processed in parallel. Lower values are usually cheaper and less likely to trigger blocking.

## `maxRequestRetries` (type: `integer`):

Maximum number of retries for failed page requests. The default retries once to avoid repeating blocked or very slow requests too many times.

## `requestTimeoutSecs` (type: `integer`):

Maximum time allowed for processing one request, including page navigation and parsing.

## `navigationTimeoutSecs` (type: `integer`):

Maximum time allowed for browser navigation. YouTube channel pages can sometimes need more than 30 seconds on cloud proxies.

## `maxSessionUses` (type: `integer`):

Retire a browser/proxy session after this many successful requests.

## `saveSnapshots` (type: `boolean`):

Save optional HTML snapshots for failed pages to help with debugging.

## `debugMode` (type: `boolean`):

Enable more detailed logs and debug metadata.

## `logLevel` (type: `string`):

Choose how much logging the Actor should produce.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/@Apify/videos"
    }
  ],
  "searchQueries": [],
  "channelHandles": [],
  "hashtags": [],
  "mode": "auto",
  "maxResultsPerSource": 25,
  "maxVideos": 25,
  "maxShorts": 10,
  "maxStreams": 5,
  "maxCommentsPerVideo": 0,
  "maxRepliesPerComment": 0,
  "includeVideoDetails": false,
  "includeChannelDetails": false,
  "includeDescriptionLinks": true,
  "includeSocialLinks": true,
  "includeComments": false,
  "includeReplies": false,
  "commentsSort": "top",
  "includeSubtitles": false,
  "subtitleLanguages": [
    "en"
  ],
  "subtitleFormat": "plainText",
  "includeTranscriptSegments": false,
  "saveSubtitlesToKeyValueStore": true,
  "searchSort": "relevance",
  "searchDateFilter": "any",
  "searchType": "video",
  "durationFilter": "any",
  "features": [],
  "channelTab": "videos",
  "channelVideoSort": "newest",
  "language": "en",
  "countryCode": "US",
  "timezone": "UTC",
  "deduplicate": true,
  "dedupeKey": "videoId",
  "datasetStrategy": "single",
  "outputGranularity": "nested",
  "errorHandling": "pushErrorItems",
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "minConcurrency": 1,
  "maxConcurrency": 2,
  "maxRequestRetries": 1,
  "requestTimeoutSecs": 90,
  "navigationTimeoutSecs": 45,
  "maxSessionUses": 25,
  "saveSnapshots": false,
  "debugMode": false,
  "logLevel": "INFO"
}
```

# Actor output Schema

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

No description

## `summary` (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/@Apify/videos"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("qaseemiqbal/youtube-intelligence-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [{ "url": "https://www.youtube.com/@Apify/videos" }] }

# Run the Actor and wait for it to finish
run = client.actor("qaseemiqbal/youtube-intelligence-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 '{
  "startUrls": [
    {
      "url": "https://www.youtube.com/@Apify/videos"
    }
  ]
}' |
apify call qaseemiqbal/youtube-intelligence-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Intelligence Scraper",
        "description": "Extract public YouTube videos, channels, playlists, Shorts, livestreams, comments, and subtitles into normalized intelligence records",
        "version": "0.1",
        "x-build-id": "XeYeOwwn96iq5j5GC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/qaseemiqbal~youtube-intelligence-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-qaseemiqbal-youtube-intelligence-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/qaseemiqbal~youtube-intelligence-scraper/runs": {
            "post": {
                "operationId": "runs-sync-qaseemiqbal-youtube-intelligence-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/qaseemiqbal~youtube-intelligence-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-qaseemiqbal-youtube-intelligence-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": {
                    "startUrls": {
                        "title": "YouTube URLs",
                        "type": "array",
                        "description": "Video, Shorts, channel, playlist, search result, hashtag, or live URLs.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL",
                                    "description": "Public YouTube URL to scrape."
                                },
                                "userData": {
                                    "type": "object",
                                    "title": "User data",
                                    "description": "Optional metadata preserved in output source context."
                                }
                            }
                        },
                        "default": []
                    },
                    "searchQueries": {
                        "title": "Search queries",
                        "type": "array",
                        "description": "Search terms exactly as they would be entered in YouTube search.",
                        "items": {
                            "type": "string",
                            "minLength": 1
                        },
                        "default": []
                    },
                    "channelHandles": {
                        "title": "Channel handles or IDs",
                        "type": "array",
                        "description": "Examples: @Apify, Apify, UCxxxx.",
                        "items": {
                            "type": "string",
                            "minLength": 1
                        },
                        "default": []
                    },
                    "hashtags": {
                        "title": "Hashtags",
                        "type": "array",
                        "description": "Hashtags to scrape without the # symbol.",
                        "items": {
                            "type": "string",
                            "minLength": 1
                        },
                        "default": []
                    },
                    "mode": {
                        "title": "Scraping mode",
                        "enum": [
                            "auto",
                            "search",
                            "videos",
                            "channels",
                            "playlists",
                            "shorts",
                            "live",
                            "comments",
                            "transcripts",
                            "hashtags",
                            "monitor"
                        ],
                        "type": "string",
                        "description": "Choose whether to auto-detect each source type or force a specific scraping workflow.",
                        "default": "auto"
                    },
                    "maxResultsPerSource": {
                        "title": "Maximum results per source",
                        "minimum": 1,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Maximum number of main results to collect from each URL, search query, channel, playlist, or hashtag. The default is intentionally small to keep runs cheap.",
                        "default": 25
                    },
                    "maxVideos": {
                        "title": "Maximum regular videos",
                        "minimum": 0,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Maximum number of regular videos to collect per source when video-type limits apply.",
                        "default": 25
                    },
                    "maxShorts": {
                        "title": "Maximum Shorts",
                        "minimum": 0,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Maximum number of YouTube Shorts to collect per source when Shorts are available.",
                        "default": 10
                    },
                    "maxStreams": {
                        "title": "Maximum live streams",
                        "minimum": 0,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Maximum number of live, upcoming, or past livestream videos to collect per source.",
                        "default": 5
                    },
                    "maxCommentsPerVideo": {
                        "title": "Maximum comments per video",
                        "minimum": 0,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Maximum number of top-level public comments to collect for each video when comments are enabled.",
                        "default": 0
                    },
                    "maxRepliesPerComment": {
                        "title": "Maximum replies per comment",
                        "minimum": 0,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of public replies to collect for each top-level comment.",
                        "default": 0
                    },
                    "includeVideoDetails": {
                        "title": "Include video details",
                        "type": "boolean",
                        "description": "Open each video page to collect richer metadata. Leave disabled for the cheapest discovery runs.",
                        "default": false
                    },
                    "includeChannelDetails": {
                        "title": "Include channel details",
                        "type": "boolean",
                        "description": "Open channel pages to collect public channel profile information. Leave disabled for lower-cost runs.",
                        "default": false
                    },
                    "includeDescriptionLinks": {
                        "title": "Extract description links",
                        "type": "boolean",
                        "description": "Extract public links found in video descriptions.",
                        "default": true
                    },
                    "includeSocialLinks": {
                        "title": "Extract social links",
                        "type": "boolean",
                        "description": "Detect common public social profile links from channel and description links.",
                        "default": true
                    },
                    "includeComments": {
                        "title": "Include comments",
                        "type": "boolean",
                        "description": "Collect public comments for videos.",
                        "default": false
                    },
                    "includeReplies": {
                        "title": "Include comment replies",
                        "type": "boolean",
                        "description": "Collect public replies under top-level comments when comments are enabled.",
                        "default": false
                    },
                    "commentsSort": {
                        "title": "Comments sort",
                        "enum": [
                            "top",
                            "newest"
                        ],
                        "type": "string",
                        "description": "Preferred public comment ordering when the page supports it.",
                        "default": "top"
                    },
                    "includeSubtitles": {
                        "title": "Include subtitles/transcripts",
                        "type": "boolean",
                        "description": "Collect public subtitles or transcripts when they are available.",
                        "default": false
                    },
                    "subtitleLanguages": {
                        "title": "Subtitle languages",
                        "type": "array",
                        "description": "Preferred subtitle language codes, such as en, de, es, or fr.",
                        "items": {
                            "type": "string",
                            "minLength": 2
                        },
                        "default": [
                            "en"
                        ]
                    },
                    "subtitleFormat": {
                        "title": "Subtitle format",
                        "enum": [
                            "plainText",
                            "srt",
                            "webvtt",
                            "xml",
                            "json"
                        ],
                        "type": "string",
                        "description": "Format used for saved subtitle or transcript output.",
                        "default": "plainText"
                    },
                    "includeTranscriptSegments": {
                        "title": "Include transcript segments",
                        "type": "boolean",
                        "description": "Include timestamped transcript segments in transcript records.",
                        "default": false
                    },
                    "saveSubtitlesToKeyValueStore": {
                        "title": "Save subtitles to Key-Value Store",
                        "type": "boolean",
                        "description": "Save full subtitle files to Apify Key-Value Store and include references in dataset records.",
                        "default": true
                    },
                    "searchSort": {
                        "title": "Search sort",
                        "enum": [
                            "relevance",
                            "uploadDate",
                            "viewCount",
                            "rating"
                        ],
                        "type": "string",
                        "description": "Preferred sorting order for YouTube search results.",
                        "default": "relevance"
                    },
                    "searchDateFilter": {
                        "title": "Search date filter",
                        "enum": [
                            "any",
                            "hour",
                            "today",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Limit YouTube search results by approximate upload date.",
                        "default": "any"
                    },
                    "searchType": {
                        "title": "Search result type",
                        "enum": [
                            "all",
                            "video",
                            "channel",
                            "playlist"
                        ],
                        "type": "string",
                        "description": "Restrict YouTube search to videos, channels, playlists, or all supported result types.",
                        "default": "video"
                    },
                    "durationFilter": {
                        "title": "Duration filter",
                        "enum": [
                            "any",
                            "short",
                            "medium",
                            "long"
                        ],
                        "type": "string",
                        "description": "Restrict search results by video duration when supported by YouTube.",
                        "default": "any"
                    },
                    "features": {
                        "title": "Search features",
                        "type": "array",
                        "description": "Optional YouTube search feature filters such as live, HD, 4K, subtitles, or Creative Commons.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "live",
                                "4k",
                                "hd",
                                "subtitles",
                                "creativeCommons",
                                "360",
                                "vr180",
                                "3d",
                                "hdr",
                                "location",
                                "purchased"
                            ]
                        },
                        "default": []
                    },
                    "channelTab": {
                        "title": "Channel tab",
                        "enum": [
                            "videos",
                            "shorts",
                            "streams",
                            "playlists",
                            "about",
                            "all"
                        ],
                        "type": "string",
                        "description": "Channel section to scrape, such as videos, Shorts, streams, playlists, about, or all supported tabs.",
                        "default": "videos"
                    },
                    "channelVideoSort": {
                        "title": "Channel video sort",
                        "enum": [
                            "newest",
                            "popular",
                            "oldest"
                        ],
                        "type": "string",
                        "description": "Preferred sort order for channel videos when available.",
                        "default": "newest"
                    },
                    "publishedAfter": {
                        "title": "Published after",
                        "type": "string",
                        "description": "Only include videos published on or after this date in YYYY-MM-DD format."
                    },
                    "publishedBefore": {
                        "title": "Published before",
                        "type": "string",
                        "description": "Only include videos published on or before this date in YYYY-MM-DD format."
                    },
                    "language": {
                        "title": "Language",
                        "type": "string",
                        "description": "Preferred YouTube interface and result language.",
                        "default": "en"
                    },
                    "countryCode": {
                        "title": "Country code",
                        "minLength": 2,
                        "maxLength": 2,
                        "type": "string",
                        "description": "Preferred two-letter country or region code for localized YouTube results.",
                        "default": "US"
                    },
                    "timezone": {
                        "title": "Timezone",
                        "type": "string",
                        "description": "Timezone used for interpreting dates and run summaries.",
                        "default": "UTC"
                    },
                    "deduplicate": {
                        "title": "Deduplicate results",
                        "type": "boolean",
                        "description": "Merge duplicate videos found from multiple sources into one canonical result.",
                        "default": true
                    },
                    "dedupeKey": {
                        "title": "Deduplication key",
                        "enum": [
                            "videoId",
                            "canonicalUrl",
                            "sourceAndVideoId"
                        ],
                        "type": "string",
                        "description": "Field used to decide whether two video records are duplicates.",
                        "default": "videoId"
                    },
                    "datasetStrategy": {
                        "title": "Dataset strategy",
                        "enum": [
                            "single",
                            "separate"
                        ],
                        "type": "string",
                        "description": "Choose whether to store all record types in one dataset or split them into separate datasets.",
                        "default": "single"
                    },
                    "outputGranularity": {
                        "title": "Output granularity",
                        "enum": [
                            "flat",
                            "nested",
                            "both"
                        ],
                        "type": "string",
                        "description": "Choose a flatter output for spreadsheets, nested output for APIs, or both.",
                        "default": "nested"
                    },
                    "errorHandling": {
                        "title": "Error handling",
                        "enum": [
                            "pushErrorItems",
                            "skipRecoverableErrors",
                            "failOnCritical"
                        ],
                        "type": "string",
                        "description": "Choose how the Actor should handle invalid sources and recoverable page errors.",
                        "default": "pushErrorItems"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings used for YouTube requests. Apify Proxy is recommended.",
                        "default": {
                            "useApifyProxy": true
                        }
                    },
                    "minConcurrency": {
                        "title": "Minimum concurrency",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Minimum number of pages processed in parallel.",
                        "default": 1
                    },
                    "maxConcurrency": {
                        "title": "Maximum concurrency",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Maximum number of pages processed in parallel. Lower values are usually cheaper and less likely to trigger blocking.",
                        "default": 2
                    },
                    "maxRequestRetries": {
                        "title": "Maximum request retries",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Maximum number of retries for failed page requests. The default retries once to avoid repeating blocked or very slow requests too many times.",
                        "default": 1
                    },
                    "requestTimeoutSecs": {
                        "title": "Request timeout seconds",
                        "minimum": 15,
                        "maximum": 600,
                        "type": "integer",
                        "description": "Maximum time allowed for processing one request, including page navigation and parsing.",
                        "default": 90
                    },
                    "navigationTimeoutSecs": {
                        "title": "Navigation timeout seconds",
                        "minimum": 10,
                        "maximum": 180,
                        "type": "integer",
                        "description": "Maximum time allowed for browser navigation. YouTube channel pages can sometimes need more than 30 seconds on cloud proxies.",
                        "default": 45
                    },
                    "maxSessionUses": {
                        "title": "Maximum session uses",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Retire a browser/proxy session after this many successful requests.",
                        "default": 25
                    },
                    "saveSnapshots": {
                        "title": "Save debug snapshots",
                        "type": "boolean",
                        "description": "Save optional HTML snapshots for failed pages to help with debugging.",
                        "default": false
                    },
                    "debugMode": {
                        "title": "Debug mode",
                        "type": "boolean",
                        "description": "Enable more detailed logs and debug metadata.",
                        "default": false
                    },
                    "logLevel": {
                        "title": "Log level",
                        "enum": [
                            "DEBUG",
                            "INFO",
                            "WARNING",
                            "ERROR"
                        ],
                        "type": "string",
                        "description": "Choose how much logging the Actor should produce.",
                        "default": "INFO"
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
