# YouTube Scraper · Transcripts & Comments · $0.5/1k (`alfalfa/youtube-scraper`) Actor

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

## Pricing

from $0.35 / 1,000 rows

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

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

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

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Scraper: videos, transcripts and comments without an API key

Get YouTube data as a table: the videos of a **search**, a **channel**, a **playlist** or a list of **video URLs**, each with title, views, likes, publish date, duration, description, tags, channel and subscriber count. Add the **transcript** (subtitles as timed segments and plain text) and the **comments** when you need them. No YouTube account, no Data API key, no quota. Export to Excel, CSV or JSON, or read it through the API.

**$0.50 per 1,000 rows** (videos or comments), transcripts $1 per 1,000 videos, no start fee, platform usage and proxies included.

### What you get

One row per video:

| Field | Example |
|---|---|
| `id`, `url`, `title` | `dQw4w9WgXcQ`, `https://www.youtube.com/watch?v=dQw4w9WgXcQ`, `Rick Astley - Never Gonna Give You Up` |
| `channelName`, `channelId`, `channelUrl`, `subscriberCount` | `Rick Astley`, `UCuAXFkgsw1L7xaCfnd5JJOw`, …, `4540000` |
| `publishedAt`, `publishedText` | `2009-10-24T23:57:33-07:00`, `16 years ago` |
| `category`, `isUnlisted` | `Music`, `false` |
| `durationText`, `durationSeconds` | `3:33`, `213` |
| `viewCount`, `likeCount`, `commentCount` | `1814324479`, `19382909`, `2400000` |
| `description`, `keywords` | full description, video tags |
| `thumbnailUrl`, `isShort`, `isLive`, `isLiveContent`, `ageRestricted` | `isLive` = live right now, `isLiveContent` = a stream, current or past |
| `transcript`, `transcriptText`, `transcriptLanguage` | `[{start: 18.64, duration: 3.24, text: "We're no strangers to love"}, …]`, the whole text, `en English` |
| `searchQuery`, `inputUrl` | where the video came from |

With **Max comments per video** above 0, comments come as extra rows with `type` = `comment`: `id`, `text`, `author`, `authorChannelId`, `authorUrl`, `authorAvatar`, `publishedText`, `likeCount`, `replyCount`, `isVerified`, `isCreator`, plus `videoId`, `videoUrl` and `videoTitle` of the video they belong to. Top comments or newest first. **Max replies per comment** adds the replies as rows too, right after their comment, with `parentId` and `replyLevel` = 1.

With **Include channel records** on, every channel gets one row with `type` = `channel`: `id`, `handle`, `name`, `description`, `country`, `joinedAt`, `viewCount` (all-time), `videoCount`, `subscriberCount`, `links` (Twitter, Instagram, website … as `{title, url}`), `avatar`, `channelKeywords`. Channel URLs get their own channel; searches and playlists get every channel that appears, once per run.

Likes, exact publish date and time, category, full description and tags need **Include video details** (on by default, one small request per video). Subscriber and comment counts need **Include subscriber and comment counts** (one larger request per video) and come automatically with comments; channel sources carry the subscriber count anyway. With details off you get the listing fields only (title, channel, views, relative date, duration), about twice as fast.

### Sources

- **Search queries**: one per line. Filter by upload date (last hour to this year) and order by relevance, upload date, views or rating.
- **Channel URLs**: `youtube.com/@handle`, `/channel/UC…`, `/c/name`, `/user/name`. Add `/videos`, `/shorts` or `/streams` to pick the tab, or set **Channel content**. Newest first, as on the channel page.
- **Playlist URLs**: `youtube.com/playlist?list=…`. A channel's uploads playlist (`UU` + channel ID) works too.
- **Video URLs**: `youtube.com/watch?v=…`, `youtu.be/…`, `/shorts/…`, `/live/…`.
- **Search result URLs** copied from the browser.

**Max videos per source** caps each search, channel or playlist. A search page holds about 20 videos; channels and playlists page 30 at a time and can go into the thousands.

### Use cases

- **Research and monitoring**: every new video on a topic this week, with views and likes, into a sheet; a competitor's channel, every Monday.
- **Transcripts for AI**: full subtitles of a channel or a search as plain text for summaries, RAG, translation or content repurposing. One run, one JSON.
- **Comment analysis**: the top or newest comments of a launch video, an ad or a podcast episode, with likes and authors, for sentiment and feedback mining.
- **Lead generation and outreach**: channels talking about your niche, their size, and the authors of the most liked comments.
- **Content planning**: the most viewed videos for a keyword in the last month, their length, tags and titles.

### Examples

Fifty most viewed Python tutorials of this month with transcripts:

```json
{ "searchQueries": ["python tutorial"], "sortBy": "views", "uploadDate": "month", "maxVideos": 50, "transcript": true }
```

Latest 200 videos of a channel, listing fields only (fast):

```json
{ "startUrls": [{ "url": "https://www.youtube.com/@mkbhd/videos" }], "maxVideos": 200, "scrapeDetails": false }
```

The newest 500 comments of one video, with up to 5 replies each:

```json
{ "startUrls": [{ "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }], "maxComments": 500, "maxReplies": 5, "commentsSort": "newest" }
```

Channel record plus the latest 50 videos of three channels:

```json
{ "startUrls": [{ "url": "https://www.youtube.com/@mkbhd" }, { "url": "https://www.youtube.com/@NASA" }, { "url": "https://www.youtube.com/@veritasium" }], "maxVideos": 50, "channelDetails": true }
```

Output row (video, shortened):

```json
{
  "type": "video",
  "id": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "subscriberCount": 4540000,
  "publishedAt": "2009-10-24T23:57:33-07:00",
  "category": "Music",
  "publishedText": "16 years ago",
  "durationText": "3:33",
  "durationSeconds": 213,
  "viewCount": 1814324479,
  "likeCount": 19382909,
  "commentCount": 2400000,
  "keywords": ["rick astley", "Never Gonna Give You Up", "nggyu"],
  "transcriptLanguage": "en English",
  "transcriptText": "We're no strangers to love. You know the rules and so do I …"
}
```

### Use it from code, n8n, Make, Zapier or an AI agent

- **API**: `POST https://api.apify.com/v2/acts/alfalfa~youtube-scraper/run-sync-get-dataset-items?token=…` with the JSON input above returns the rows directly (runs up to 5 minutes). Longer jobs: start the run, poll, read the dataset. Any Apify client library works.
- **n8n, Make, Zapier**: add the Apify node, pick `alfalfa/youtube-scraper`, paste the same JSON input and read the run's dataset in the next step. See the [Apify integrations docs](https://docs.apify.com/platform/integrations).
- **AI agents and MCP (Claude, Cursor, VS Code, ChatGPT)**: connect the Apify MCP server with this Actor as a tool, `https://mcp.apify.com/?tools=alfalfa/youtube-scraper`, and the agent can pull videos, transcripts and comments by describing what it wants. See [Apify MCP docs](https://docs.apify.com/platform/integrations/mcp).

### Pricing

| Event | Price |
|---|---|
| Video row | $0.50 per 1,000 ($0.45 / $0.40 / $0.35 on Starter / Scale / Business plans) |
| Comment or reply row | same as a video row |
| Transcript | $1.00 per 1,000 videos with a transcript, nothing for videos without captions |
| Channel record | $1.50 per 1,000 channels on top of the row, i.e. $2 per 1,000 channels in total on the free plan |
| Start fee, platform usage, proxies | none, included |

A run's **Maximum total charge** is honoured: the Actor stops before the budget, so the bill never exceeds it.

### Limits and honesty

- Public videos only. Private, deleted and members-only videos are reported as unavailable, not charged. Age-restricted videos return the listing fields and the details with `ageRestricted: true`; their comments and transcripts are not readable without a login.
- YouTube shows rounded counts in some places (`21.2M subscribers`, `2.4M comments`); the rounded value is what you get. Views and likes are exact.
- Transcripts exist only where the uploader or YouTube's auto-captioning provided them. Live streams have none while live.
- Search returns what YouTube's search shows a visitor in the US with English settings: about 20 videos per page and rarely more than 500-600 results per query. Split by upload date for more.
- Comment replies come with **Max replies per comment**; they count towards the per-video comment limit.

### FAQ

**Do I need a YouTube API key?** No. The Data API's free quota is 10,000 units a day (a few hundred searches); this Actor has no quota and no key.

**Does it work for Shorts?** Yes: Shorts URLs, a channel's Shorts tab, and Shorts in search results. `isShort` marks them.

**Can I get subtitles in another language?** Set **Transcript language** to a language code. Manual captions in that language are preferred, then auto-generated ones in it, then a manual track in any language, then the first track available. `transcriptLanguage` records what was used.

**Is this legal?** The Actor reads public pages the way a visitor without an account does and stores nothing but the results in your dataset. Respect YouTube's terms and copyright when you reuse the content, and personal data laws for comment authors.

**How fast is it?** About 100 videos with details in 20-30 seconds; listing only, several hundred a minute. Comments add one request per 20 comments, a transcript two requests per video.

### Related Actors by the same author

| Actor | What it does | Price |
|---|---|---|
| [LinkedIn Jobs Scraper](https://apify.com/alfalfa/linkedin-jobs-scraper) | public LinkedIn job postings by keyword, location, date, company or URL, with full description, salary, applicants, seniority and poster | $0.50 per 1,000 jobs |
| [Facebook Ads Library Scraper](https://apify.com/alfalfa/facebook-ads-library-scraper) | ads from the Meta Ad Library by keyword, advertiser page or URL, with creatives, dates, platforms and EU reach | $0.50 per 1,000 ads |
| [Facebook Posts Scraper](https://apify.com/alfalfa/facebook-posts-scraper) | posts of any public page or profile with reactions, comment counts, media, optional video transcripts | $2 per 1,000 posts |
| [Facebook Comments Scraper](https://apify.com/alfalfa/facebook-comments-scraper) | comments and replies of any public post | $0.50 per 1,000 comments |
| [Facebook Pages Scraper](https://apify.com/alfalfa/facebook-pages-scraper) | page details with email, phone, address, followers, rating, About text | from $3.50 per 1,000 pages |
| [Facebook Events Scraper](https://apify.com/alfalfa/facebook-events-scraper) | events by search, page or URL with dates, venue, tickets and organizer email | $5 per 1,000 events |

Not affiliated with, endorsed by or connected to YouTube, Google LLC or Apify.

# Actor input Schema

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

What to search for on YouTube, one query per line: <code>data engineering tutorial</code>, <code>iphone review</code>. Each query is one source of up to <b>Max videos</b> results.

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

Video URLs (<code>youtube.com/watch?v=...</code>, <code>youtu.be/...</code>, <code>/shorts/...</code>), channel URLs (<code>youtube.com/@handle</code>, <code>/channel/UC...</code>, with <code>/videos</code>, <code>/shorts</code> or <code>/streams</code>), playlist URLs (<code>playlist?list=...</code>) or search result URLs. Each URL is one source on top of the search queries. A watch URL with a <code>list=</code> parameter counts as the video, not the playlist.

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

Maximum videos per search query, channel or playlist. A search returns about 20 videos per page; channels and playlists can go into the thousands.

## `scrapeDetails` (type: `boolean`):

Open every video for likes, exact publish date and time, category, full description and tags. One small extra request per video, no surcharge. Off = listing fields only (title, views, date text, duration), about twice as fast. Automatically on when transcripts, comments or counts are requested.

## `engagementCounts` (type: `boolean`):

Add the channel's subscriber count and the video's comment count. One larger extra request per video, no surcharge; also filled automatically when comments are collected.

## `transcript` (type: `boolean`):

Download the video's subtitles as timed segments and plain text (manual captions preferred, auto-generated as fallback). One extra request per video. Charged separately per video with a transcript, see the pricing.

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

Preferred language code of the transcript, e.g. <code>en</code>, <code>de</code>, <code>es</code>. When the video has no captions in that language, a manual track in another language is used, then the first available one; the language used is recorded in <code>transcriptLanguage</code>.

## `maxComments` (type: `integer`):

Comments to collect per video, saved as separate rows with <code>type</code> = <code>comment</code> and the video ID. 0 = no comments. Twenty comments per request.

## `maxReplies` (type: `integer`):

Replies to collect under each comment, as rows with <code>parentId</code> and <code>replyLevel</code> 1. 0 = no replies. Replies count towards <b>Max comments per video</b>. Ten replies per request.

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

YouTube's Top comments or newest first.

## `channelDetails` (type: `boolean`):

One extra row with <code>type</code> = <code>channel</code> per channel: description, country, joined date, total views, video and subscriber counts, handle, external links. For channel URLs the channel itself; for video URLs, searches and playlists every channel that appears (once per run). Charged separately per channel, see the pricing.

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

Order of search results (search queries and search URLs only).

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

Only search results uploaded within this window (search queries only).

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

Which tab of a channel URL to read when the URL itself does not say (<code>/videos</code>, <code>/shorts</code>, <code>/streams</code>).

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

Sources processed in parallel (default 5). Pages of one source are always read in order.

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

Residential proxies are included in the price. Leave the default unless you want your own proxy servers.

## Actor input object example

```json
{
  "searchQueries": [
    "data engineering tutorial"
  ],
  "maxVideos": 20,
  "scrapeDetails": true,
  "engagementCounts": false,
  "transcript": false,
  "transcriptLanguage": "en",
  "maxComments": 0,
  "maxReplies": 0,
  "commentsSort": "top",
  "channelDetails": false,
  "sortBy": "relevance",
  "uploadDate": "any",
  "channelTab": "videos",
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

All scraped rows as JSON. Append ?format=csv for CSV.

# 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 = {
    "searchQueries": [
        "data engineering tutorial"
    ],
    "maxVideos": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("alfalfa/youtube-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 = {
    "searchQueries": ["data engineering tutorial"],
    "maxVideos": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("alfalfa/youtube-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 '{
  "searchQueries": [
    "data engineering tutorial"
  ],
  "maxVideos": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call alfalfa/youtube-scraper --silent --output-dataset

```

## MCP server setup

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