# YouTube Scraper API: Transcripts, Videos, Comments & Channels (`clair-api/youtube-scraper-api`) Actor

YouTube transcripts, video details, comments, channel videos, and search results as JSON, in 1-3 seconds each. No login, no API quota. Views, likes, captions with timestamps.

- **URL**: https://apify.com/clair-api/youtube-scraper-api.md
- **Developed by:** [Clair API](https://apify.com/clair-api) (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.50 / 1,000 transcripts

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/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 Scraper API: Transcripts, Videos, Comments & Channels

YouTube transcripts, video details, comments, channel videos, and search results as JSON, in 1-3 seconds each. No login, no API quota. Views, likes, captions with timestamps.

Built on [YouTube API](https://clair.im/apis/youtube?utm_source=apify\&utm_medium=store\&utm_campaign=youtube-scraper-api), a production
API that answers from live pages. Each input is one API call; calls run in
parallel, and every row lands in the dataset as soon as it is read.

### What it returns

#### Transcripts

video_id takes an 11-character id or any watch, shorts, embed, live, or youtu.be link. Without language, English is returned when the video has it, else its first uploaded track. A language such as pt matches a regional track such as pt-BR.

Input `transcripts`: a video id or any YouTube video link. Typical time: 1-3 s per call.

Sample row:

```json
{
  "input": "jNQXAC9IVRw",
  "endpoint": "youtube",
  "language": "en",
  "kind": "manual",
  "text": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... real...",
  "segments": [
    {
      "start_ms": 1200,
      "duration_ms": 2160,
      "text": "All right, so here we are, in front of the elephants"
    },
    {
      "start_ms": 5318,
      "duration_ms": 2656,
      "text": "the cool thing about these guys is that they have really..."
    },
    "… 4 more"
  ]
}
```

#### Videos

A public video’s title, description, length, views, likes, publish time, category, keywords, and channel with its subscriber count. video_id takes an id or any YouTube link to the video.

Input `videos`: a video id or any YouTube video link. Typical time: 1-3 s per call.

Sample row:

```json
{
  "input": "aircAruvnKk",
  "endpoint": "youtube-video",
  "video_id": "aircAruvnKk",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "description": "What are the neurons, why are there layers, and what is the math underlying it? ...",
  "duration": "18:40",
  "duration_seconds": 1120,
  "views": 25243630,
  "likes": 570276,
  "comments_count": 9500,
  "published_at": "2017-10-05T08:11:25-07:00",
  "category": "Education",
  "keywords": [],
  "thumbnail": "https://i.ytimg.com/vi/aircAruvnKk/maxresdefault.jpg",
  "live": false,
  "family_safe": true,
  "unlisted": false,
  "channel": {
    "channel_id": "UCYO_jab_esuFRV4b17AJtAw",
    "name": "3Blue1Brown",
    "handle": "@3blue1brown",
    "url": "https://www.youtube.com/@3blue1brown",
    "verified": true,
    "subscribers": 8750000
  }
}
```

#### Comments

Top-level comments on a public video, 20 at a time, by YouTube’s top order or newest first. Each carries its text, likes, reply count, and author. next_cursor opens the next 20. A video with comments turned off returns 404.

Input `commentVideos`: a video id or link whose comments to read. Typical time: 1-2 s per call.

Sample row:

```json
{
  "input": "aircAruvnKk",
  "endpoint": "youtube-comments",
  "position": 1,
  "comment_id": "Ugwedfi--9yZVC0eefl4AaABAg",
  "text": "I study mathematics, physics and architecture. By definition this man is an ORACLE in the strict meaning of the word. ",
  "published": "7 years ago (edited)",
  "likes": 14000,
  "replies_count": 175,
  "author": {
    "channel_id": "UCqArZkt3NAOU0tcgIi6xmFQ",
    "name": "@kummer45",
    "verified": false,
    "creator": false
  }
}
```

#### Channel videos

The channel’s name, handle, description, subscribers, and video count, with its videos 30 at a time, newest first. channel takes an @handle, a channel id starting with UC, or a link to the channel. next_cursor opens the next 30 videos; a continued page carries videos only, with channel null.

Input `channels`: an @handle, a channel id starting with UC, or a channel link. Typical time: 1-4 s per call.

Sample row:

```json
{
  "input": "@3blue1brown",
  "endpoint": "youtube-channel",
  "channel": {
    "channel_id": "UCYO_jab_esuFRV4b17AJtAw",
    "name": "3Blue1Brown",
    "handle": "@3blue1brown",
    "url": "https://www.youtube.com/@3blue1brown",
    "description": "My name is Grant Sanderson. ...",
    "subscribers": 8750000,
    "videos_count": 247,
    "avatar": "https://yt3.googleusercontent.com/ytc/AIdro_nFzZFPLxPZRHcE3SSwzdrbuWqfoWYwLAu0_2iO6blQYAU=s900-c-k-c0x00ffffff-no-rj",
    "banner": "https://yt3.googleusercontent.com/JfUD9Tu79zgoYGo5-WdP5YYj0XvAjPgV3c2Snj-cgy8jslro0Ln5by024zWL7XDin7Vs-qnxVg=w2560-fc...",
    "keywords": "Mathematics",
    "family_safe": true,
    "rss_url": "https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw"
  },
  "position": 1,
  "video_id": "LKrwhjOI8Nc",
  "title": "There's never been a better time to go into math",
  "url": "https://www.youtube.com/watch?v=LKrwhjOI8Nc",
  "thumbnail": "https://i.ytimg.com/vi/LKrwhjOI8Nc/hq720.jpg?sqp=-oaymwEnCNAFEJQDSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4...",
  "duration": "40:44",
  "duration_seconds": 2444,
  "views": 2700000,
  "published": "4 weeks ago"
}
```

#### Searches

One page of YouTube search results, about 20 at a time, in YouTube’s relevance order. type picks videos (the default), channels, playlists, or all, which mixes them as YouTube’s own results page does. next_cursor, sent back as cursor, opens the next page.

Input `searches`: a search, as typed into YouTube. Typical time: 1-4 s per call.

Sample row:

```json
{
  "input": "python tutorial for beginners",
  "endpoint": "youtube-search",
  "type": "video",
  "position": 1,
  "video_id": "kqtD5dpn9C8",
  "title": "Python for Beginners - Learn Coding with Python in 1 Hour",
  "url": "https://www.youtube.com/watch?v=kqtD5dpn9C8",
  "thumbnail": "https://i.ytimg.com/vi/kqtD5dpn9C8/hq720.jpg?sqp=-oaymwEnCNAFEJQDSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4...",
  "duration": "1:00:06",
  "duration_seconds": 3606,
  "views": 25914186,
  "published": "6 years ago",
  "snippet": "Learn Python basics in just 1 hour! Perfect for beginners interested in AI and coding. ⚡ Plus, get 6 months of PyChar...",
  "live": false,
  "channel": {
    "channel_id": "UCWv7vMbMWH4-V0ZXdmDpPBA",
    "name": "Programming with Mosh",
    "handle": "@programmingwithmosh",
    "url": "https://www.youtube.com/@programmingwithmosh",
    "verified": true
  }
}
```

### Pricing

Pay per row, nothing for a run's time. You are charged only for rows with
data:

- **Transcript**: One video's captions, as plain text and as timed segments.
- **Video**: One video's details: title, views, likes, comments, channel, and keywords.
- **Comment**: One top-level comment with its likes and reply count.
- **Channel video**: One video from a channel's uploads, with the channel's details.
- **Search result**: One video, channel, or playlist from a YouTube search.

An input that does not exist (a deleted post, an unknown username) or that
fails after three tries comes back as a free row with `error` and
`message` set. Set a spending limit on the run and it stops there.

### Use it from code

Every input field is in the API tab. Prefer plain HTTP? The same data is
the [YouTube API](https://clair.im/apis/youtube?utm_source=apify\&utm_medium=readme\&utm_campaign=youtube-scraper-api), with a free monthly
allowance.

### Notes

- Unofficial: not affiliated with or endorsed by YouTube. It reads what
  the site shows a signed-out visitor, and nothing behind a login.
- Rows are JSON objects; export them as JSON, CSV, Excel, or through the API.

# Actor input Schema

## `transcripts` (type: `array`):

One per line: a video id or any YouTube video link. Each is one call to Transcript (/v1/youtube/transcript). One YouTube video’s transcript.

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

One per line: a video id or any YouTube video link. Each is one call to Video (/v1/youtube/video). One YouTube video’s details and counts.

## `commentVideos` (type: `array`):

One per line: a video id or link whose comments to read. Each is one call to Comments (/v1/youtube/comments). A YouTube video’s comments, 20 at a time.

## `commentPages` (type: `integer`):

How many pages to read for each input, 1 to 10. Every row on them is charged.

## `channels` (type: `array`):

One per line: an @handle, a channel id starting with UC, or a channel link. Each is one call to Channel (/v1/youtube/channel). A YouTube channel’s profile and its videos, newest first.

## `channelPages` (type: `integer`):

How many pages to read for each input, 1 to 10. Every row on them is charged.

## `searches` (type: `array`):

One per line: a search, as typed into YouTube. Each is one call to Search (/v1/youtube/search). YouTube search results: videos, channels, or playlists.

## `searchPages` (type: `integer`):

How many pages to read for each input, 1 to 10. Every row on them is charged.

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

Caption language code, such as en, de, or pt-BR. pt also matches pt-BR. Default: English, else the first uploaded track. Applies to Transcripts.

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

top or newest. Default top. Applies to Comments.

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

video, channel, playlist, or all. Default video. Applies to Searches.

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

Inputs called at once, 1 to 10.

## Actor input object example

```json
{
  "transcripts": [
    "jNQXAC9IVRw"
  ],
  "commentPages": 1,
  "channelPages": 1,
  "searchPages": 1,
  "maxConcurrency": 5
}
```

# Actor output Schema

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

One row per transcript, video, comment, channel video, or search result. An input without data gets a free row with error set.

# 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 = {
    "transcripts": [
        "jNQXAC9IVRw"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("clair-api/youtube-scraper-api").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 = { "transcripts": ["jNQXAC9IVRw"] }

# Run the Actor and wait for it to finish
run = client.actor("clair-api/youtube-scraper-api").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 '{
  "transcripts": [
    "jNQXAC9IVRw"
  ]
}' |
apify call clair-api/youtube-scraper-api --silent --output-dataset

```

## MCP server setup

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

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/OkGb6fCwamnSjxb5e/builds/ywyGkFvpM5Mt5Uiqz/openapi.json
