# YouTube Scraper: Videos, Comments, Transcripts & Channels (`prs_scraper/youtube-intelligence-scraper`) Actor

Scrape YouTube videos, Shorts, live streams, channels, playlists, search results, comments and transcripts in one run. Engagement metrics, delta monitoring and optional AI summaries. No login, no YouTube API key. From $0.80 per 1,000 videos.

- **URL**: https://apify.com/prs_scraper/youtube-intelligence-scraper.md
- **Developed by:** [PRS](https://apify.com/prs_scraper) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 1,000 video with full details

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

**YouTube Intelligence Scraper** is a **YouTube scraper and YouTube API alternative** that collects every
kind of public YouTube data in one run: **videos, Shorts, live streams, channels, playlists, search
results, hashtags, comments with replies and transcripts**. Paste YouTube URLs or type search terms, and
get clean, typed records with **engagement analytics already computed** and optional **AI summaries,
topics, comment sentiment and sponsor detection**. No login, no YouTube API key, no quota.

##### Why teams choose this YouTube scraper

- ✅ **Everything in one run**: videos, Shorts, streams, channels, playlists, search, hashtags, comments, replies, transcripts. No second Actor, no second bill
- ✅ **Low price**: from **$0.80 per 1,000 videos**, **$1.80** with full details (Business plan). Error records are free
- ✅ **Nothing to set up**: no login, cookies, YouTube API key or proxy settings. Proxies, retries and pacing are handled for you
- ✅ **Analytics built in**: engagement rate, views per day, views per subscriber, upload cadence, median views, top videos
- ✅ **Monitoring that saves money**: delta mode returns only new videos, or the views and likes gained since the last run
- ✅ **AI-ready**: transcripts as clean text, one nested record per video for LLMs and RAG, optional AI enrichment with your own key
- ✅ **No silent failures**: every input returns records or an error record with a code and a hint
- ✅ **Stable schema**: `recordType` on every record, numbers as numbers, ISO dates, versioned

### Table of contents

- [What can this YouTube scraper do?](#what-can-this-youtube-scraper-do)
- [What YouTube data can you scrape?](#what-youtube-data-can-you-scrape)
- [How to scrape YouTube in 5 steps](#how-to-scrape-youtube-in-5-steps)
- [How much does it cost to scrape YouTube?](#how-much-does-it-cost-to-scrape-youtube)
- [YouTube Intelligence Scraper vs the YouTube Data API](#youtube-intelligence-scraper-vs-the-youtube-data-api)
- [Input parameters](#input-parameters)
- [Shorts](#shorts)
- [Input examples by use case](#input-examples-by-use-case)
- [AI enrichment](#ai-enrichment)
- [Output](#output)
- [Output layout: flat or nested](#output-layout-flat-or-nested)
- [Built-in analytics](#built-in-analytics)
- [Reliability and limitations](#reliability-and-limitations)
- [API, Python, JavaScript and AI agents](#api-python-javascript-and-ai-agents)
- [Troubleshooting](#troubleshooting)
- [Use cases](#use-cases)
- [FAQ](#faq)

### What can this YouTube scraper do?

You give it YouTube URLs, search terms, or both. It returns one record per video, channel, playlist,
comment and transcript.

| You add | You get |
|---|---|
| 🎬 Video, Short or live URL | the video with full details |
| 📺 Channel (`@handle`, `/channel/UC…`, `/c/`, `/user/`) | the channel, its videos, and optionally its Shorts, streams and playlists |
| 📃 Playlist | the playlist and its videos |
| 🔎 Search term or search results URL | matching videos, Shorts, channels or playlists |
| #️⃣ Hashtag page | the videos under that hashtag |
| 🆔 Bare ID (`dQw4w9WgXcQ`, `UC…`, `PL…`, `@handle`) | the same as its URL |

URLs and search terms can be **combined** in one run. Anything found through several inputs is saved, and
charged, **once**, with `matchedInputs` listing every input that found it.

It reads the same JSON data the YouTube website and apps use, without a browser. That makes it fast and
light: in fast listing mode, a channel's 1,000 newest videos take about a dozen requests. With full
details (the default), each video is opened as well.

### What YouTube data can you scrape?

| Record | What you get |
|---|---|
| 🎬 **Video** (also Shorts, live, upcoming, premieres) | title, description, links, hashtags, tags, category, thumbnails, duration, publish date, views, likes, comment count, chapters, **most-replayed segments**, **music credits**, caption languages, blocked countries, embeddable flag, live details, age-restricted / members-only / unlisted flags, channel name, handle, subscribers, verified badge |
| 📺 **Channel** | handle, title, description, social links, country, join date, subscribers, total videos and views, avatar, banner, verified badge, keywords, plus a **summary** of its videos in this run |
| 📃 **Playlist** | title, description, owner, video count, views, last updated, the videos collected from it |
| 💬 **Comment** | text, author (name, handle, channel, creator / verified badge), likes, reply count, pinned, hearted, edited, date, parent comment for replies |
| 📝 **Transcript** | language, manual or auto-generated, timed segments or plain text / SRT / VTT, available languages |
| 🧠 **AI** (optional, on videos) | summary, topics, comment sentiment with themes, sponsor segments, key moments |
| ⚠️ **Error** | the input, its URL, a code (`VIDEO_UNAVAILABLE`, `PRIVATE`, `COMMENTS_DISABLED`, `NO_TRANSCRIPT`, …), a message and a hint |

| Feature | How it helps |
|---|---|
| 💬 Comments in the same run | no second scraper, no second bill for the same videos |
| 📝 Existing captions as transcripts | SRT, VTT, plain text or timed segments, in the language you prefer |
| 🔁 Delta mode | scheduled runs return only what is new or changed |
| 📈 Derived metrics | engagement and growth numbers on every video and channel |
| ✅ Data quality score | `dataQuality.completeness` and `missingFields` on every video |
| ⚡ Fast listing mode | title, views, duration and thumbnail without opening each video |
| 🧠 AI enrichment (optional) | summaries, topics, comment sentiment, sponsor segments, key moments, with your own OpenAI-compatible key |
| 🛟 Resumable runs | a server migration continues the run without duplicates or double charges |

### How to scrape YouTube in 5 steps

1. Click **Try for free** and open the Actor in Apify Console.
2. Add **Start URLs** (channels, videos, playlists, searches) and/or **Search terms**.
3. Set how many **videos** you want per source. Turn on **Include Shorts** if you also want Shorts.
4. Turn on what else you need: **Comments**, **Transcripts**, **Channel playlists**, **AI enrichment**.
5. Click **Start**. Open the **Videos**, **Engagement**, **Channels**, **Comments**, **Transcripts** or
   **Errors** tab, or download everything as JSON, CSV, Excel, XML or HTML.

The smallest useful input:

```json
{
  "startUrls": ["https://www.youtube.com/@GoogleDevelopers"],
  "maxVideos": 50
}
```

### How much does it cost to scrape YouTube?

Pay per event: you pay only for the records you get, never for compute time or proxies. Prices depend on
your Apify plan, and the higher plans get the biggest discount:

| Event | Free plan | Business plan (Gold discount) |
|---|---|---|
| Video with full details (also Shorts and live streams) | $4.00 per 1,000 | **$1.80 per 1,000** |
| Video in fast listing mode (`includeVideoDetails: false`) | $3.00 per 1,000 | **$0.80 per 1,000** |
| Channel | $4.00 per 1,000 | $1.00 per 1,000 |
| Comment or reply | $1.00 per 1,000 | $0.50 per 1,000 |
| Transcript | $4.00 per 1,000 | $1.00 per 1,000 |
| AI enrichment with your own key (per enriched video, plus your AI provider's tokens) | $1.00 per 1,000 | $1.00 per 1,000 |
| Actor start (per run, per GB of memory; the default 512 MB = 1) | $0.005 | $0.005 |
| Error records, playlists, failed AI calls | free | free |

The **Pricing** tab shows the exact price for your plan.

Worked examples:

| Run | Free plan | Business plan |
|---|---|---|
| 1,000 videos with full details from 5 channels | about **$4.03** | about **$1.81** |
| 5,000 videos of one channel in fast listing mode | about **$15.01** | about **$4.01** |
| 100 videos with transcripts and AI summaries (+ your AI provider's tokens) | about **$0.91** | about **$0.39** |
| Daily delta run that finds 10 new videos | about **$0.05** | about **$0.02** |

**On the Apify free plan**, the monthly $5 credit covers about **1,250 videos with full details** or
**about 1,650 in fast listing mode**.

Set a **maximum cost per run** in Run options. The Actor checks the budget *before* fetching each item,
so it never does work you will not pay for, and it stops cleanly with a status message when the limit
is reached.

### Input parameters

Add at least one start URL or search term. Everything else is optional.

#### Sources

| Field | Type | Description | Default |
|---|---|---|---|
| `startUrls` | array | Any mix of YouTube URLs or bare IDs (see the table below) | - |
| `searchQueries` | array | Keywords to search on YouTube, e.g. `python tutorial` | - |

| URL type | Example |
|---|---|
| Video | `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `https://youtu.be/dQw4w9WgXcQ` |
| Short | `https://www.youtube.com/shorts/VIDEO_ID` |
| Live stream | `https://www.youtube.com/live/VIDEO_ID` |
| Channel | `https://www.youtube.com/@handle`, `/channel/UC…`, `/c/name`, `/user/name` |
| Channel tab | `https://www.youtube.com/@handle/videos`, `/shorts`, `/streams`, `/playlists` |
| Playlist | `https://www.youtube.com/playlist?list=PL…` |
| Search results | `https://www.youtube.com/results?search_query=…` (keeps its own filters) |
| Hashtag | `https://www.youtube.com/hashtag/python` |
| Bare ID | `dQw4w9WgXcQ`, `UC_x5XG1OV2P6uZZ5FSM9Ttw`, `PL…`, `@handle` |

A line that is not recognised becomes an `INVALID_URL` error record. It does not stop the run.

#### Limits

Limits apply **per source** (per channel, playlist, search term or search URL).

| Field | Type | Description | Default |
|---|---|---|---|
| `maxVideos` | integer | Long-form videos per source | `50` |
| `includeShorts` | boolean | Also collect Shorts (see [Shorts](#shorts)) | `false` |
| `maxShorts` | integer | Shorts per source, used when `includeShorts` is on | `20` |
| `maxStreams` | integer | Live streams and premieres per channel. 0 = none | `0` |
| `oldestPostDate` | string | Skip items published before this date: `2025-01-31` or `30 days` | - |
| `newestPostDate` | string | Skip items published after this date | - |

#### What to collect

| Field | Type | Description | Default |
|---|---|---|---|
| `includeVideoDetails` | boolean | On: likes, full description, tags, category, exact date, chapters. Off: fast listing mode | `true` |
| `includeChannelInfo` | boolean | One channel record per channel | `true` |
| `includeComments` | boolean | Collect comments for every video | `false` |
| `maxCommentsPerVideo` | integer | Top-level comments per video | `100` |
| `includeReplies` | boolean | Also collect replies (needs `includeComments`) | `false` |
| `maxRepliesPerComment` | integer | Replies per comment | `20` |
| `commentsSort` | string | `top` or `newest` | `top` |
| `includeTranscript` | boolean | Download existing captions for every video | `false` |
| `transcriptLanguages` | array | Language codes in order of preference | `["en"]` |
| `preferAutoGenerated` | boolean | Prefer auto-generated captions over manual ones | `false` |
| `transcriptFormat` | string | `segments`, `text`, `srt` or `vtt` | `segments` |
| `translateTranscriptTo` | string | Ask YouTube for its own translation, e.g. `de` | - |
| `includePlaylists` | boolean | For channels, also list the channel's playlists | `false` |

#### Search filters

These apply to search terms. A search results URL keeps its own filters. `type: "short"` also applies to
channel URLs: the channel returns only its Shorts (up to `maxShorts`).

| Field | Type | Description | Default |
|---|---|---|---|
| `sortBy` | string | `relevance`, `date`, `views`, `rating` | `relevance` |
| `uploadDate` | string | `any`, `hour`, `today`, `week`, `month`, `year` | `any` |
| `type` | string | `any`, `video`, `short`, `channel`, `playlist`, `movie` | `any` |
| `duration` | string | `any`, `under4`, `4to20`, `over20` | `any` |
| `features` | array | `live`, `4k`, `hd`, `subtitles`, `cc`, `360`, `vr180`, `3d`, `hdr`, `location`, `purchased` | - |
| `gl` | string | Two-letter country code for results, e.g. `US`, `IN`, `DE` | `US` |
| `hl` | string | Language of titles and texts, e.g. `en`, `de`, `pt-BR` | `en` |

#### Channel options

| Field | Type | Description | Default |
|---|---|---|---|
| `channelSortBy` | string | Order of a channel's videos: `newest`, `popular`, `oldest` | `newest` |

#### Monitoring

| Field | Type | Description | Default |
|---|---|---|---|
| `deltaMode` | boolean | Skip videos already collected by a previous run with the same state key | `false` |
| `stateName` | string | Name of the store that keeps state between runs, e.g. `my-channel-monitor` (formerly `stateKey`, still accepted) | - |
| `trackStatChanges` | boolean | Also re-emit known videos with the views, likes and comments gained (needs `deltaMode`) | `false` |

#### AI enrichment (optional)

| Field | Type | Description | Default |
|---|---|---|---|
| `aiEnabled` | boolean | Add an `ai` object to videos | `false` |
| `aiApiKey` | string (secret) | Your OpenAI-compatible API key. Required when `aiEnabled` is on | - |
| `aiBaseUrl` | string | OpenAI-compatible endpoint | `https://api.openai.com/v1` |
| `aiModel` | string | Model name | `gpt-4o-mini` |
| `aiTasks` | array | `summary`, `topics`, `sentiment_of_comments`, `sponsor_segments`, `key_moments` | - |
| `aiMaxVideos` | integer | Enrich at most this many videos per run | `50` |

#### Output

| Field | Type | Description | Default |
|---|---|---|---|
| `outputMode` | string | `flat` or `nested` (see [Output layout](#output-layout-flat-or-nested)) | `flat` |
| `webhookUrl` | string | The run summary is POSTed here as JSON when the run finishes | - |

There are no proxy, concurrency or timeout settings. The Actor manages them itself.

### Shorts

**Shorts are collected only when you ask for them.** By default a run returns long-form videos only, so
you never pay for Shorts you did not want.

There are four ways to ask:

| You want | Set |
|---|---|
| Shorts along with videos, from channels, searches, hashtags and playlists | `includeShorts: true`, and `maxShorts` for how many per source |
| Only the Shorts of a channel | add the channel's Shorts tab: `https://www.youtube.com/@handle/shorts`, or set `type: "short"` |
| Only Shorts from a search | `type: "short"` |
| One specific Short | add its URL: `https://www.youtube.com/shorts/VIDEO_ID` |

With `includeShorts` off, a Short that sits inside a playlist or among search results is skipped and
**not charged**. Every Short record has `contentType: "short"` and a `/shorts/` URL, so Shorts and videos
are easy to tell apart in the same dataset.

```json
{
  "startUrls": ["https://www.youtube.com/@mkbhd"],
  "maxVideos": 50,
  "includeShorts": true,
  "maxShorts": 30
}
```

### Input examples by use case

#### Channel analytics: the last 100 videos of two channels

```json
{
  "startUrls": ["https://www.youtube.com/@GoogleDevelopers", "https://www.youtube.com/@mkbhd"],
  "maxVideos": 100
}
```

You get one channel record per channel, with `summary.uploadsPerWeek`, `medianViews` and `topVideoIds`,
and every video with its `derived` engagement metrics.

#### Fast, cheap listing of a whole channel

```json
{
  "startUrls": ["https://www.youtube.com/@GoogleDevelopers/videos"],
  "maxVideos": 5000,
  "includeVideoDetails": false
}
```

Listing mode returns title, views, duration, thumbnail and a relative date ("3 weeks ago") without
opening each video: $0.80 per 1,000 on the Business plan ($3.00 on the Free plan).

#### Shorts research: trending Shorts for a topic

```json
{
  "searchQueries": ["street food", "home workout"],
  "type": "short",
  "maxShorts": 100,
  "uploadDate": "week"
}
```

#### Keyword research: this week's long videos about a topic

```json
{
  "searchQueries": ["home espresso", "latte art"],
  "maxVideos": 50,
  "uploadDate": "week",
  "duration": "over20",
  "gl": "US",
  "hl": "en"
}
```

#### Audience research: comments and replies

```json
{
  "startUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "includeComments": true,
  "maxCommentsPerVideo": 2000,
  "includeReplies": true,
  "maxRepliesPerComment": 20,
  "commentsSort": "newest"
}
```

#### Transcripts for search, RAG or subtitles

```json
{
  "startUrls": ["https://www.youtube.com/playlist?list=UU_x5XG1OV2P6uZZ5FSM9Ttw"],
  "maxVideos": 200,
  "includeTranscript": true,
  "transcriptLanguages": ["en", "en-GB"],
  "transcriptFormat": "srt"
}
```

#### Daily monitoring: only what changed since yesterday

```json
{
  "startUrls": ["https://www.youtube.com/@GoogleDevelopers"],
  "maxVideos": 30,
  "deltaMode": true,
  "trackStatChanges": true,
  "stateName": "google-devs-monitor",
  "webhookUrl": "https://hooks.example.com/youtube"
}
```

Schedule it daily. The first run saves the 30 newest videos. Every later run adds new uploads and
re-emits known videos with `statsDelta` (views, likes and comments gained), then POSTs a summary to
your webhook.

#### AI summaries and sponsor detection

```json
{
  "startUrls": ["https://www.youtube.com/@mkbhd"],
  "maxVideos": 10,
  "includeTranscript": true,
  "includeComments": true,
  "maxCommentsPerVideo": 100,
  "aiEnabled": true,
  "aiApiKey": "sk-your-key",
  "aiModel": "gpt-4o-mini",
  "aiTasks": ["summary", "topics", "sentiment_of_comments", "sponsor_segments"]
}
```

### AI enrichment

Turn on **AI enrichment** and each video gets an `ai` object, computed by one chat call per video to any
**OpenAI-compatible** endpoint: OpenAI, Azure OpenAI, OpenRouter, Groq, Together, a local server, and
others. You bring the key, so you choose the model and pay your provider directly.

| Task | Field | Needs |
|---|---|---|
| `summary` | `ai.summary` | - |
| `topics` | `ai.topics` | - |
| `sentiment_of_comments` | `ai.commentSentiment` (positive / neutral / negative shares, themes) | `includeComments` |
| `sponsor_segments` | `ai.sponsorSegments` (start, end, sponsor) | `includeTranscript` with timestamps (`segments`, `srt` or `vtt`) |
| `key_moments` | `ai.keyMoments` (start, title) | `includeTranscript` with timestamps |

```json
{
  "ai": {
    "model": "gpt-4o-mini",
    "tasks": ["summary", "topics", "sponsor_segments"],
    "summary": "A hands-on review of the new phone, focused on battery life and the camera...",
    "topics": ["smartphones", "battery life", "camera review"],
    "sponsorSegments": [{"startSeconds": 62, "endSeconds": 118, "sponsor": "ExampleVPN", "description": "VPN ad read"}],
    "skipped": [],
    "error": null
  }
}
```

- **Cost**: $0.001 per enriched video (**$1.00 per 1,000**), plus your provider's tokens. A failed AI call is
  not charged.
- **Safe by design**: a failed call sets `ai.error` and the video is still saved. A task whose input is
  missing is listed in `ai.skipped` instead of guessed.
- **Bounded**: `aiMaxVideos` caps how many videos are enriched per run (default 50).
- Your key is stored as a secret input and is sent only to the endpoint you set.

### Output

A video record (shortened):

```json
{
  "recordType": "video",
  "schemaVersion": "1.0",
  "scrapedAt": "2026-11-04T17:17:30Z",
  "source": "innertube",
  "inputSource": "dQw4w9WgXcQ",
  "matchedInputs": ["dQw4w9WgXcQ"],
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "contentType": "video",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "category": "Music",
  "durationSeconds": 213,
  "durationText": "3:33",
  "publishedAt": "2009-10-25T06:57:33Z",
  "publishedAtPrecision": "exact",
  "viewCount": 1832621351,
  "likeCount": 19492286,
  "commentCount": 2400000,
  "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "channelName": "Rick Astley",
  "channelHandle": "@RickAstleyYT",
  "channelSubscriberCount": 4550000,
  "derived": {
    "engagementRate": 0.011946,
    "likeToViewRatio": 0.010636,
    "commentToViewRatio": 0.00131,
    "viewsPerDay": 294694.78,
    "viewsPerSubscriber": 402.7739,
    "ageDays": 6218.71
  },
  "dataQuality": {"completeness": 1.0, "missingFields": [], "partial": false}
}
```

Rules that hold for every record:

- Every record has a `recordType`: `video`, `channel`, `playlist`, `comment`, `transcript` or `error`.
- Counts are numbers, never text. Dates are ISO 8601 with a precision flag (`exact`, `day` or `relative`).
- Missing values are `null` or `[]`, never an error, and `dataQuality.missingFields` names them.
- `contentType` tells a `video` from a `short`, `live`, `upcoming` or `premiere`.

Export as **JSON, CSV, Excel, XML or HTML**, or read the data through the Apify API.

### Output layout: flat or nested

The **Output** section of the input has one choice, **Output layout**, and an optional **Webhook URL**.

| Output layout | `outputMode` | What you get |
|---|---|---|
| **Flat (one record per entity)** - the default | `flat` | One row per video, channel, playlist, comment and transcript. Each kind has its own table |
| **Nested (comments and transcript inside videos)** | `nested` | One row per video, with its `comments` and `transcript` inside it |

#### Flat (default)

Like a spreadsheet, each table holds one kind of row:

| Output tab | Dataset | One row per |
|---|---|---|
| Videos, Engagement | the run's default dataset | video, Short or live stream, with its channel's name, subscribers, video count, total views, country and joined date |
| Channels | `channels` | channel, with a summary of its videos in this run |
| Playlists | `playlists` | playlist |
| Comments | `comments` | comment or reply (replies have a `parentId`) |
| Transcripts | `transcripts` | video transcript |
| Errors | `errors` | input or item that could not be collected, with a code and what to do |

The **Export** button and the plain dataset API give the videos. The other tables are in the run's
**Storage** tab and in the **Output** tab links. Join them on `videoId` / `channelId`.

Choose flat for spreadsheets, databases and BI tools, and whenever you collect many comments per video.

#### Nested

Choose **Nested (comments and transcript inside videos)** when you want everything about a video in one
record, for example to feed an LLM or a document store:

```json
{
  "startUrls": ["https://youtu.be/dQw4w9WgXcQ"],
  "includeComments": true,
  "maxCommentsPerVideo": 100,
  "includeTranscript": true,
  "outputMode": "nested"
}
```

Each video then carries its comments and transcript (shortened):

```json
{
  "recordType": "video",
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "viewCount": 1832621351,
  "comments": [
    {
      "recordType": "comment",
      "id": "UgzGvNrRmQ8ZqQ0mVbR4AaABAg",
      "videoId": "dQw4w9WgXcQ",
      "text": "Still a great song.",
      "author": {"name": "@musicfan", "handle": "@musicfan"},
      "likeCount": 1200,
      "replyCount": 3
    }
  ],
  "transcript": {
    "recordType": "transcript",
    "videoId": "dQw4w9WgXcQ",
    "language": "en",
    "isAutoGenerated": false,
    "format": "text",
    "text": "We're no strangers to love. You know the rules and so do I..."
  }
}
```

Channels, playlists and errors stay in their own tables in both layouts. The price is the same in both:
nested comments and transcripts are charged like flat ones.

#### Webhook URL

Optional. When the run finishes, a JSON summary (status, record counts, dataset IDs, cost) is POSTed to
this URL, e.g. `https://example.com/hooks/youtube`. Use it to start your own pipeline.

### Built-in analytics

No spreadsheet formulas needed: the numbers analysts compute by hand are already in the records.

| Where | Metric | Meaning |
|---|---|---|
| `video.derived` | `engagementRate` | (likes + comments) / views |
| `video.derived` | `likeToViewRatio`, `commentToViewRatio` | likes or comments per view |
| `video.derived` | `viewsPerDay`, `ageDays` | how fast the video collects views |
| `video.derived` | `viewsPerSubscriber` | reach beyond the channel's own audience |
| `video.mostReplayed` | top 5 segments | the strongest moments of YouTube's replay graph |
| `video.statsDelta` | views, likes, comments gained | change since the previous run (delta mode) |
| `video.dataQuality` | `completeness`, `missingFields`, `partial` | how complete the record is, from 0 to 1 |
| `channel.summary` | `uploadsPerWeek` | upload cadence |
| `channel.summary` | `avgViews`, `medianViews`, average engagement | typical performance |
| `channel.summary` | `topVideoIds`, last upload | best videos and recency |

The **Engagement** output tab shows the video metrics as a ready-made table.

### Reliability and limitations

| Built in | What it does |
|---|---|
| Managed proxies | rotating sessions, one exit IP per session, automatic switch to residential IPs when YouTube refuses datacenter ones |
| Adaptive pacing | slows down per IP on a rate limit and speeds up again on success |
| Classified retries | blocks, timeouts and server errors are retried separately, with backoff |
| Partial records instead of losses | if YouTube refuses part of a video's data, the video is still saved and flagged `dataQuality.partial` |
| Budget check before each item | no work is done for records your maximum cost cannot pay for |
| Resume after migration | no duplicates and no double charges |

Limitations:

- Listing pages show relative dates ("3 weeks ago") and abbreviated subscriber and comment counts
  (2.68M). Details mode has exact dates, views and likes.
- Date parsing of listing pages is English only. With another `hl`, listing-mode dates are `null` (views,
  durations and live status are still filled), and details mode still has exact dates.
- Comment dates are relative.
- Comments and transcripts of age-restricted and members-only videos need a signed-in account. This
  Actor never logs in, so they come back as error records (`AGE_RESTRICTED`, `MEMBERS_ONLY`); the video
  record itself is still saved.
- YouTube accepts "sort by upload date" for searches but no longer applies it. Use `uploadDate`.
- Caption translation is currently refused by YouTube for most videos; you then get the original language.
- No video or audio downloads. No channel e-mails.

### API, Python, JavaScript and AI agents

- **Apify API**: start runs and read datasets from any language. See the **API** tab of this Actor.
- **Clients**: [Python](https://docs.apify.com/api/client/python) and [JavaScript](https://docs.apify.com/api/client/js).
- **No-code**: Google Sheets, Zapier, Make, n8n, Slack and more through [Apify integrations](https://docs.apify.com/platform/integrations).
- **AI agents**: use it as a tool through the [Apify MCP server](https://mcp.apify.com) in Claude, Cursor
  or any MCP client. Every input field has a description written for agents, and the output schema is
  stable and versioned.
- **Scheduling**: combine an Apify schedule with `deltaMode` for monitoring.

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("<APIFY_USERNAME>/youtube-intelligence-scraper").call(run_input={
    "startUrls": ["https://www.youtube.com/@GoogleDevelopers"],
    "maxVideos": 100,
})
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(video["title"], video["viewCount"], video["derived"]["engagementRate"])
```

#### JavaScript

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('<APIFY_USERNAME>/youtube-intelligence-scraper').call({
    startUrls: ['https://www.youtube.com/@GoogleDevelopers'],
    maxVideos: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((video) => console.log(video.title, video.viewCount));
```

#### cURL: run and get the videos in one request

```bash
curl -X POST "https://api.apify.com/v2/acts/<APIFY_USERNAME>~youtube-intelligence-scraper/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": ["https://www.youtube.com/@GoogleDevelopers"], "maxVideos": 20}'
```

### Troubleshooting

#### I got no Shorts

Shorts are off by default. Turn on **Include Shorts**, or use one of the other ways in [Shorts](#shorts).

#### I got fewer videos than I asked for

The source has no more (the run log says what each input returned), the date filter removed them, or the
maximum cost per run was reached. Limits are per source, not per run.

#### I got fewer comments than I asked for

In Top order YouTube serves only "featured" comments, and on some videos that list ends after about
1,000. Use `commentsSort: newest` for every comment.

#### Some videos have an error record instead of data

Open the **Errors** tab. Each row has a code (`PRIVATE`, `VIDEO_UNAVAILABLE`, `NO_TRANSCRIPT`,
`COMMENTS_DISABLED`, …) and a hint that says what to do. Error records are free.

#### The run fails with "aiApiKey: AI enrichment needs an API key"

AI enrichment is on but no key was given. Add your `aiApiKey` (and `aiBaseUrl` / `aiModel` for a
non-OpenAI endpoint), or turn AI enrichment off.

#### Some videos have `ai.error` or `ai.skipped`

`ai.error` means the AI call failed (for example a wrong key, model name or provider limit); it is not
charged. `ai.skipped` lists tasks whose input was missing, such as comment sentiment without
`includeComments`.

#### Why is the channel record after its videos?

It carries a `summary` of those videos, so it is written when the input finishes.

#### Why do some Shorts have no date in listing mode?

YouTube's Shorts tab shows no dates. With `includeVideoDetails` on (the default), each Short gets its
exact date.

Error codes: `INVALID_URL`, `NOT_FOUND`, `VIDEO_UNAVAILABLE`, `PRIVATE`, `AGE_RESTRICTED`, `MEMBERS_ONLY`,
`REGION_BLOCKED`, `CHANNEL_HAS_NO_VIDEOS`, `CHANNEL_HAS_NO_SHORTS`, `CHANNEL_HAS_NO_STREAMS`,
`DATE_FILTER_TOO_STRICT`, `COMMENTS_DISABLED`, `NO_TRANSCRIPT`, `BLOCKED`, `NETWORK_ERROR`, `PARSE_ERROR`.

### Use cases

- **Competitor and channel analytics**: upload cadence, median views and top videos of any channel.
- **Influencer vetting**: real engagement rates and views per subscriber before you sign a creator.
- **Content and keyword research**: what ranks for a topic this week, by region and language.
- **Shorts trend tracking**: the Shorts a topic or channel is producing, with their view counts.
- **Audience and sentiment research**: comments and replies at scale, with optional AI sentiment.
- **LLM and RAG pipelines**: transcripts as clean text, one nested record per video.
- **Brand monitoring**: scheduled delta runs that report only new videos and stat changes.
- **Sponsorship research**: sponsor segments and music credits across a channel's videos.

### FAQ

#### Do I need a YouTube API key?

No. There is no key, no quota and no login.

#### Is there a free way to scrape YouTube?

Yes, within Apify's free plan: its monthly $5 credit covers about 1,250 videos with full details, or about
1,650 in fast listing mode.

#### What does it cost per 1,000 YouTube videos?

On the Business plan, $1.80 per 1,000 videos with full details and $0.80 per 1,000 in fast listing mode; on
the Free plan, $4.00 and $3.00. Comments, transcripts and channels are priced separately. See
[the price table](#how-much-does-it-cost-to-scrape-youtube).

#### Do I need my own proxies?

No. Proxies are included and managed by the Actor.

#### How many videos can I get?

Set `maxVideos` as high as you like. Channels and playlists are walked page by page until the limit or
the end, and searches go as deep as YouTube serves results. Memory stays flat on large runs.

#### Can I scrape YouTube comments and transcripts?

Yes, in the same run as the videos: turn on `includeComments` and `includeTranscript`. Comments come with
replies, likes and author badges; transcripts in segments, text, SRT or VTT.

#### Are Shorts included?

Only when you ask: turn on `includeShorts`, or add a Shorts URL. See [Shorts](#shorts).

#### Which output layout should I use?

Flat (the default) for tables and exports. Nested when you want one record per video with its comments
and transcript inside. See [Output layout](#output-layout-flat-or-nested).

#### Does it run speech-to-text?

No. Transcripts are the captions that already exist on YouTube, manual or auto-generated.

#### Which AI models can I use?

Any model behind an OpenAI-compatible chat endpoint: set `aiBaseUrl`, `aiApiKey` and `aiModel`. The default
is OpenAI's `gpt-4o-mini`.

#### Can I get only new videos on each run?

Yes. Turn on `deltaMode`, set a `stateName` and schedule the Actor.

#### Is it legal to scrape YouTube?

The Actor collects only public data that anyone can see without logging in. Comments contain personal
data (names, handles), so make sure your use complies with GDPR and similar laws, and with YouTube's terms
for your use case. If in doubt, ask a lawyer.

#### Something is wrong or missing. Where do I report it?

Open an issue in the **Issues** tab of this Actor, with the run ID. Feature requests are welcome there too.

# Actor input Schema

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

Any mix of YouTube URLs or bare IDs: video (https://www.youtube.com/watch?v=dQw4w9WgXcQ), Short (/shorts/ID), live (/live/ID), channel (/@handle, /channel/UC…, /c/name, /user/name, optionally ending in /videos, /shorts, /streams, /playlists), playlist (/playlist?list=PL…), search results (/results?search_query=…), hashtag (/hashtag/python). Bare IDs work too: dQw4w9WgXcQ, UC_x5XG1OV2P6uZZ5FSM9Ttw, PL…, @handle. Unrecognised lines become INVALID_URL error records and do not stop the run.

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

Keywords to search on YouTube, e.g. 'python tutorial'. Each term is one source for maxVideos / maxShorts. The search filters below apply to these terms.

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

Long-form videos to collect from each channel, playlist or search. 0 = none. Example: 50.

## `includeShorts` (type: `boolean`):

Off (default): no Shorts are collected from channels, searches, hashtags or playlists - only long-form videos. On: Shorts are collected too, up to 'Max Shorts per source'. A Shorts link you add yourself (/shorts/ID, a channel's /shorts tab) and Result type = Shorts (searches and channel URLs then return Shorts only) are always collected.

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

Used when 'Include Shorts' is on: Shorts to collect from each channel, search or hashtag. Example: 20.

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

Past, current and upcoming live streams / premieres from each channel's Live tab. 0 = none. Example: 10.

## `oldestPostDate` (type: `string`):

Skip items published before this date. ISO date ('2025-01-31') or relative ('30 days', '2 weeks', '6 months'). Channel listings stop early once they reach older uploads, which saves requests.

## `newestPostDate` (type: `string`):

Skip items published after this date. ISO date ('2025-06-30') or relative ('7 days').

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

On: likes, full description, tags, category, exact publish date, chapters. Off: fast listing mode (title, views, duration, thumbnail, relative date) - cheaper and much faster.

## `includeChannelInfo` (type: `boolean`):

Emit one channel record per channel (subscribers, total views, links, country, upload summary) instead of repeating channel data in every video.

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

Collect comments for every video in the same run (no second Actor needed).

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

Top-level comments per video. Example: 100.

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

Also collect replies to each comment. Requires Comments.

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

Example: 20.

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

Top comments (YouTube's ranking) or newest first.

## `includeTranscript` (type: `boolean`):

Download existing captions (manual or auto-generated) for every video. No speech-to-text is run.

## `transcriptLanguages` (type: `array`):

Language codes in order of preference, e.g. \['en', 'en-GB', 'de']. The first available one is used.

## `preferAutoGenerated` (type: `boolean`):

By default manual captions win over auto-generated ones in the same language.

## `transcriptFormat` (type: `string`):

segments = list of {start, duration, text}; text = one plain string; srt / vtt = subtitle files as text.

## `translateTranscriptTo` (type: `string`):

Optional language code, e.g. 'de'. Uses YouTube's own caption translation when YouTube allows it; otherwise the original language is returned with isTranslated=false.

## `includePlaylists` (type: `boolean`):

For channel sources, also emit a record for each of the channel's playlists.

## `sortBy` (type: `string`):

Order of search results. Note: YouTube currently applies only relevance and views; date and rating are sent but YouTube returns its own order (checked 2026-11-04). For recent videos use Upload date.

## `uploadDate` (type: `string`):

Only results uploaded within this period.

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

Only this kind of result. Shorts also applies to channel URLs: a channel then returns only its Shorts (up to 'Max Shorts per source'), even with 'Include Shorts' off.

## `duration` (type: `string`):

Video length.

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

Results must have all selected features, e.g. \['hd', 'subtitles'].

## `gl` (type: `string`):

Two-letter country code for results and region-dependent data, e.g. 'US', 'IN', 'DE'.

## `hl` (type: `string`):

Interface language for titles and texts YouTube localises, e.g. 'en', 'de', 'pt-BR'.

## `channelSortBy` (type: `string`):

Order in which a channel's videos, Shorts and streams are listed.

## `deltaMode` (type: `boolean`):

Skip videos already collected by a previous run with the same state key. Ideal for scheduled monitoring.

## `stateName` (type: `string`):

Name of the key-value store that keeps state between runs, e.g. 'my-channel-monitor'. Use a different name for each monitoring task. Letters, digits and '-'. (Formerly 'stateKey', which is still accepted.)

## `trackStatChanges` (type: `boolean`):

In delta mode, also re-emit known videos with a statsDelta (views, likes, comments gained since the previous run). Requires delta mode.

## `aiEnabled` (type: `boolean`):

Add an 'ai' object to videos with the selected tasks: one OpenAI-compatible chat call per video, using its title, description, transcript (if includeTranscript) and comments (if includeComments). A failed call sets ai.error; the video is always saved.

## `aiBaseUrl` (type: `string`):

OpenAI-compatible endpoint, e.g. 'https://api.openai.com/v1' (the default). Only used with your own aiApiKey.

## `aiApiKey` (type: `string`):

Key for the AI endpoint. Leave empty to use the Actor's hosted AI if the owner offers it (charged per enriched video); otherwise the run fails with a hint.

## `aiModel` (type: `string`):

Model name at the endpoint, e.g. 'gpt-4o-mini' (the default). Only used with your own aiApiKey.

## `aiTasks` (type: `array`):

What to compute for each video. Comment sentiment needs includeComments; sponsor segments and key moments need includeTranscript (with timestamps: transcriptFormat segments, srt or vtt).

## `aiMaxVideos` (type: `integer`):

AI enrichment is applied to at most this many videos per run.

## `outputMode` (type: `string`):

flat = one record per entity (video, channel, comment, transcript…) with a recordType field; nested = comments and transcript inside each video record.

## `webhookUrl` (type: `string`):

Optional. The run summary is POSTed here as JSON when the run finishes, e.g. 'https://example.com/hooks/youtube'.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/@GoogleDevelopers"
    }
  ],
  "maxVideos": 50,
  "includeShorts": false,
  "maxShorts": 20,
  "maxStreams": 0,
  "includeVideoDetails": true,
  "includeChannelInfo": true,
  "includeComments": false,
  "maxCommentsPerVideo": 100,
  "includeReplies": false,
  "maxRepliesPerComment": 20,
  "commentsSort": "top",
  "includeTranscript": false,
  "transcriptLanguages": [
    "en"
  ],
  "preferAutoGenerated": false,
  "transcriptFormat": "segments",
  "includePlaylists": false,
  "sortBy": "relevance",
  "uploadDate": "any",
  "type": "any",
  "duration": "any",
  "gl": "US",
  "hl": "en",
  "channelSortBy": "newest",
  "deltaMode": false,
  "trackStatChanges": false,
  "aiEnabled": false,
  "aiMaxVideos": 50,
  "outputMode": "flat"
}
```

# Actor output Schema

## `videos` (type: `string`):

Videos, Shorts and live streams, one row each.

## `engagement` (type: `string`):

Derived metrics and stat changes.

## `channels` (type: `string`):

Channel records.

## `playlists` (type: `string`):

Playlist records.

## `comments` (type: `string`):

Comments and replies.

## `transcripts` (type: `string`):

Transcripts.

## `errors` (type: `string`):

What could not be collected, and why.

## `allRecords` (type: `string`):

Every video record, all fields.

# 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/@GoogleDevelopers"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("prs_scraper/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/@GoogleDevelopers" }] }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.youtube.com/@GoogleDevelopers"
    }
  ]
}' |
apify call prs_scraper/youtube-intelligence-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,prs_scraper/youtube-intelligence-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/TSk163n0JMgA0yRFe/builds/y6IhrvF46DfaZUO6T/openapi.json
