# YouTube Transcript Ninja ⚡️🥷⚡ (`topaz_sharingan/youtube-transcript-scraper-1`) Actor

Extract transcripts from YouTube videos with ease! This actor takes a YouTube video URL as input and returns the transcript of the video in the specified format.

- **URL**: https://apify.com/topaz\_sharingan/youtube-transcript-scraper-1.md
- **Developed by:** [Moses Ceaser](https://apify.com/topaz_sharingan) (community)
- **Categories:** AI, Developer tools
- **Stats:** 8,057 total users, 412 monthly users, 100.0% runs succeeded, 827 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$10.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/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 Transcript Actor

### 📌 Introduction

#### 🎯 What is this actor?

The **YouTube Transcript Actor** is a powerful tool designed to extract transcripts from YouTube videos. It takes a **YouTube video URL** as input and returns the **transcript** in a structured format.

#### 🚀 Key Features

- Extract transcripts from YouTube videos
- Support for multiple languages
- Option to **include timestamps**
- Clean text formatting
- JSON output for easy integration

#### 🔍 Use Cases

- **Content creators** can generate subtitles for their videos
- **Researchers** can perform **sentiment analysis** or **text processing** on video transcripts
- **Accessibility advocates** can **make video content more accessible**

***

### 📥 Inputs

#### 📝 What does the actor take in?

The YouTube Transcript Actor accepts the following inputs:

- **`startUrls`** (*required*): A list of YouTube video URLs to extract transcripts from.
- **`includeTimestamps`** (*optional*): A toggle to include timestamps in the output (**Yes/No**).

#### 🔒 Restrictions

- You must provide a **valid YouTube URL**.
- Some videos **do not have transcripts available** (e.g., live streams, private videos).

#### ✅ Example Input

```json
{
    "startUrls": ["https://www.youtube.com/watch?v=cPMJOaD-eZk"],
    "includeTimestamps": "Yes"
}
```

***

### 📤 Outputs

#### 📝 What does the actor return?

The actor produces:

- **A clean transcript** (default: plain text)
- **Timestamps** (*optional*)
- **JSON format** for structured data processing

#### ⚠️ Restrictions

- If a video has **no transcript available**, the result will be `null`.

#### ✅ Example Outputs

##### 🔹 **Without Timestamps (`includeTimestamps`: "No")**

```json
{
    "transcript": "We have skewed the lines. We are no longer raising women in our culture..."
}
```

##### 🔹 **With Timestamps (`includeTimestamps`: "Yes")**

```json
{
    "transcript": [
        { "timestamp": "0:01", "text": "We've skewed the lines." },
        {
            "timestamp": "0:04",
            "text": "We are no longer raising women in our culture."
        }
    ]
}
```

***

### ⚙️ How to Use

#### 🏁 Running the Actor

1. **Log in** or **Sign up** on [Apify](https://apify.com).
2. **Create a new task** and select **"YouTube Transcript Actor"**.
3. **Enter the YouTube video URL(s)** in the `startUrls` field.
4. **Choose whether to include timestamps** (`includeTimestamps`: "Yes" or "No").
5. **Start the task** and receive your transcript in JSON format.

#### 📊 Interpreting Results

- If timestamps are **enabled**, the transcript is returned as an **array of objects** (`[{ timestamp, text }]`).
- If timestamps are **disabled**, the transcript is returned as **plain text**.

***

### 🛠️ Troubleshooting

#### ❌ Common Issues & Fixes

| Issue                  | Possible Cause                        | Solution                        |
| ---------------------- | ------------------------------------- | ------------------------------- |
| `Transcript not found` | Video has **no transcript available** | Choose another video            |
| `Invalid URL error`    | URL is **incorrect or missing**       | Ensure the URL is **valid**     |
| `Empty transcript`     | YouTube **restricted the transcript** | Try **another video or region** |

***

### 🔗 Additional Resources

- [Alternative YouTube Transcript Actor](https://apify.com/vistics/youtube-transcript-scraper-2-1k-results)
- [Apify Platform](https://apify.com)
- [Check out my profile](https://apify.com/topaz_sharingan)

***

### 🙌 Acknowledgments

This actor was built with the support of the **Apify community** and the **YouTube API**. Special thanks to all contributors! 🎉

# Actor input Schema

## `timestamps` (type: `boolean`):

If true, returns transcript array with timestamps. If false, returns joined text only.

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

List of YouTube video URLs to scrape transcripts from

## Actor input object example

```json
{
  "timestamps": false,
  "startUrls": [
    "https://www.youtube.com/watch?v=SieELGaJV8k"
  ]
}
```

# 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": [
        "https://www.youtube.com/watch?v=SieELGaJV8k"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("topaz_sharingan/youtube-transcript-scraper-1").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": ["https://www.youtube.com/watch?v=SieELGaJV8k"] }

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

```

## MCP server setup

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

```

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/dB9f4B02ocpTICIEY/builds/ayATfSQV1IJRYFTwg/openapi.json
