# Youtube Transcript Scraper (`shahidirfan/youtube-transcript-scraper`) Actor

Extract YouTube video transcripts, subtitles, captions, timestamps, video metadata, and text at scale. Scrape accurate transcript data from YouTube URLs for AI training, LLM datasets, content analysis, research, SEO, summarization, and automation workflows.

- **URL**: https://apify.com/shahidirfan/youtube-transcript-scraper.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

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

### What does YouTube Transcript Scraper API do?

YouTube Transcript Scraper API extracts transcripts, timestamped segments, and public metadata from one or more YouTube video URLs. Add direct video links to `video_urls`, choose a caption language, and receive one structured dataset item per video. It uses `@egoist/youtube-transcript-plus` as the primary provider, with `youtube-transcript` as a fallback. Every request is sent through `impit` (Chrome impersonation) so a residential Apify proxy can be applied.

The Actor is useful for building searchable transcript libraries, AI and RAG datasets, research collections, accessibility workflows, and content analysis pipelines. It supports standard watch links, shortened links, Shorts, live video links, and embed links.

### Why use YouTube Transcript Scraper API?

- **Transcript-first output** - Get complete caption text and timestamped segments in a predictable format.
- **Proxy-ready** - All requests go through `impit`, so an Apify residential proxy is applied to the InnerTube player call and the caption download.
- **Batch video processing** - Submit multiple video URLs in one run and receive one result per video.
- **Language selection** - Request a language by name, such as `English` or `Spanish`, or by code, such as `en`.
- **Metadata included** - Combine transcript content with titles, descriptions, publication text, views, duration, thumbnails, creator information, and public status fields.
- **Clean dataset records** - Unavailable values are omitted instead of being returned as `null`, empty strings, or empty arrays.
- **Workflow-ready exports** - Download results as JSON, CSV, Excel, XML, and other Apify dataset formats, or connect the run to webhooks and integrations.

### What data can you extract from YouTube videos?

| Field                            | Description                                       |
| -------------------------------- | ------------------------------------------------- |
| `video_id`                       | Stable YouTube video identifier.                  |
| `title`                          | Public video title.                               |
| `url`                            | Canonical watch URL for the video.                |
| `description`                    | Public video description when available.          |
| `transcript`                     | Complete caption text in reading order.           |
| `transcript_language`            | Language label selected for the transcript.       |
| `transcript_language_code`       | Language code, such as `en` or `es`.              |
| `transcript_segments`            | Array of timestamped caption segments.            |
| `transcript_segments[].start_ms` | Segment start time in milliseconds.               |
| `transcript_segments[].end_ms`   | Segment end time in milliseconds when available.  |
| `transcript_segments[].text`     | Caption text for the segment.                     |
| `published_text`                 | Publication date or relative publication text.    |
| `view_count`                     | Numeric public view count when available.         |
| `duration_seconds`               | Video duration in seconds.                        |
| `thumbnail_url`                  | Best available video thumbnail.                   |
| `tags`                           | Public video tags when available.                 |
| `channel_id`                     | Public creator channel identifier when available. |
| `channel_title`                  | Public creator channel name when available.       |
| `channel_url`                    | Public creator channel URL when available.        |
| `has_captions`                   | Whether captions were available for the video.    |
| `video_details_fetched`          | Whether the video detail request completed.       |

### How to use YouTube Transcript Scraper API

1. Open the Actor in Apify Console.
2. Add one or more direct YouTube video URLs to **YouTube video URLs**.
3. Enter a caption language, or keep the default `English`.
4. Start the run.
5. Open the dataset to review transcript text, timestamps, and metadata.
6. Export the dataset or connect it to your application, webhook, or automation.

Only direct video URLs are accepted. Channel pages, playlists, search pages, and other non-video pages are not input sources for this Actor.

### Input parameters

| Parameter    | Type             | Required | Default                     | Description                                                                                                                                                                        |
| ------------ | ---------------- | -------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `video_urls` | Array of strings | Yes      | Example video URL           | One or more direct YouTube video URLs. Duplicate URLs are processed once.                                                                                                          |
| `language`   | String           | No       | `English`                   | Caption language name or code, such as `English`, `en`, or `Spanish`.                                                                                                              |
| `proxy`      | Object           | No       | `{ "useApifyProxy": true }` | Apify proxy configuration. Use residential proxies to avoid YouTube bot detection on datacenter IPs, for example `{ "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }`. |

The values provided by the user are used as supplied. The requested `language` takes priority over any available-language fallback. If the requested language is unavailable, the Actor keeps the video metadata and omits transcript fields rather than silently selecting another language.

### Usage examples

#### Extract one video transcript

Use a one-item array when you need a single transcript.

```json
{
    "video_urls": ["https://www.youtube.com/watch?v=7pq7jlR0R6o"],
    "language": "English"
}
```

#### Extract several video transcripts

Submit multiple direct links to process them in the same run.

```json
{
    "video_urls": ["https://www.youtube.com/watch?v=7pq7jlR0R6o", "https://www.youtube.com/watch?v=hePb00CqvP0"],
    "language": "English"
}
```

#### Request a specific caption language

Use a language code when you need an exact language request.

```json
{
    "video_urls": ["https://www.youtube.com/watch?v=7pq7jlR0R6o"],
    "language": "es"
}
```

### Sample output

The exact fields depend on the public information and captions available for each video at run time.

```json
{
    "video_id": "7pq7jlR0R6o",
    "title": "Avengers Endgame: Encore | Official Trailer I In Cinemas Sep 25",
    "url": "https://www.youtube.com/watch?v=7pq7jlR0R6o",
    "description": "Reassemble the team and relive the experience as Avengers Endgame: Encore returns in cinemas September 25.",
    "duration_seconds": 96,
    "has_captions": true,
    "transcript_language": "English (auto-generated)",
    "transcript_language_code": "en",
    "transcript": "Hey Cap, you read me? Cap, it's Sam. Can you hear me?",
    "transcript_segments": [
        {
            "start_ms": 7960,
            "end_ms": 10880,
            "text": "Hey Cap, you read me?"
        }
    ]
}
```

### Transcript behavior

- Captions are matched to the requested language name or language code.
- Automatic captions are included when YouTube provides them for the requested language.
- Transcript segments include start times and end times when the source provides them.
- JSON3, WebVTT, and XML caption responses are normalized into the same segment structure.
- Videos without captions still return available public metadata.
- Private, removed, age-restricted, or temporarily unavailable videos may return fewer fields or fail to produce a dataset item.
- Null values, empty strings, and empty arrays are omitted recursively from dataset records.

### Tips for best results

- Use complete public video URLs copied from YouTube.
- Use a language code such as `en` when matching a particular language matters.
- Start with one or two videos to check transcript availability before submitting a larger list.
- Keep `video_id` as the stable key when joining results across runs.
- Review the dataset preview because captions, counts, descriptions, and availability can change.
- Keep the requested language consistent when comparing transcripts across multiple videos.

### Integrations and exports

- **Google Sheets** - Review transcript text, titles, and timestamp segments in a spreadsheet.
- **Webhooks** - Notify downstream services after a run completes.
- **Make or Zapier** - Send transcript records into no-code workflows.
- **Apify API** - Start runs and retrieve dataset items programmatically.
- **AI and RAG pipelines** - Load transcript text and timestamps into search, embedding, or knowledge-base workflows.
- **Exports** - Download JSON, CSV, Excel, XML, and other supported dataset formats.

### Frequently asked questions

#### Does the Actor accept multiple videos?

Yes. Add multiple direct video URLs to the `video_urls` array. The Actor returns one dataset item per unique URL.

#### Does the Actor accept a channel URL or playlist URL?

No. The input is intentionally limited to direct YouTube video URLs. Add individual video links to `video_urls` instead.

#### Can I request automatic captions?

Yes. Automatic captions are returned when they are the available track for the requested language. The language label identifies automatic captions when YouTube provides that information.

#### What happens when a video has no transcript?

The Actor returns the public metadata that is available and omits transcript fields. A missing transcript can mean that captions are disabled, the requested language is unavailable, or YouTube did not make captions available for that request.

#### Can I export the results to CSV or Excel?

Yes. Apify datasets can be downloaded as CSV, Excel, JSON, XML, and other supported formats.

#### Can I run the Actor on a schedule?

Yes. Schedule repeated runs in Apify Console with the same list of video URLs to refresh transcript and metadata records.

#### Does this require a YouTube login or API key?

No. The Actor is intended for publicly available YouTube videos and captions. All requests use the unofficial InnerTube API through `impit`, with no `po_token` requirement.

#### How are requests sent?

Every request (the watch page, InnerTube player call, and caption download) is made by `impit` with Chrome browser impersonation. If you configure the `proxy` input, those requests share one sticky residential proxy session so YouTube sees a consistent IP while validating the caption URL. Failed requests rotate to a new session before retrying.

#### Is collecting YouTube data legal?

You are responsible for complying with YouTube's terms, applicable laws, copyright rules, and privacy requirements. Collect and use public data responsibly.

### Related Actors

No additional related Actor links are listed because another relevant public Actor under the Shahid Irfan profile could not be verified while preparing this README. This avoids publishing guessed or incorrect links.

### Support

For issues or feature requests, use the Issues tab on the Actor page or contact the developer through Apify.

### Legal notice

This Actor is intended for legitimate collection of publicly available information. Users are responsible for complying with YouTube's terms of service, applicable laws, copyright obligations, and privacy rules.

# Actor input Schema

## `video_urls` (type: `array`):

One or more direct YouTube video URLs. Channel URLs are not supported.

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

Caption language to fetch. Use a language name such as English or a language code such as en.

## `proxy` (type: `object`):

Apify proxy configuration. YouTube blocks datacenter IPs, so a RESIDENTIAL proxy group is required for transcripts and metadata to load. Example: { "useApifyProxy": true, "apifyProxyGroups": \["RESIDENTIAL"] }.

## Actor input object example

```json
{
  "video_urls": [
    "https://www.youtube.com/watch?v=7pq7jlR0R6o"
  ],
  "language": "English",
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `overview` (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 = {
    "video_urls": [
        "https://www.youtube.com/watch?v=7pq7jlR0R6o"
    ],
    "language": "English"
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/youtube-transcript-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 = {
    "video_urls": ["https://www.youtube.com/watch?v=7pq7jlR0R6o"],
    "language": "English",
}

# Run the Actor and wait for it to finish
run = client.actor("shahidirfan/youtube-transcript-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 '{
  "video_urls": [
    "https://www.youtube.com/watch?v=7pq7jlR0R6o"
  ],
  "language": "English"
}' |
apify call shahidirfan/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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