# Youtube Transcript Scraper. $2/1k results⚡ (`vistics/youtube-transcript-scraper-2-1k-results`) Actor

Extract transcripts from any YouTube video in seconds.
Supports auto-generated & manual captions, timestamps,
JSON & plain text output. Perfect for content creators,
researchers, SEO & NLP projects. 🎬

- **URL**: https://apify.com/vistics/youtube-transcript-scraper-2-1k-results.md
- **Developed by:** [Ilong Mamman](https://apify.com/vistics) (community)
- **Categories:** Social media, Developer tools, Automation
- **Stats:** 142 total users, 13 monthly users, 100.0% runs succeeded, 35 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$2.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Scraper

### 📌 Introduction

The **YouTube Transcript Scraper** is a robust tool for extracting transcripts from YouTube videos. Whether you need auto-generated captions or user-uploaded subtitles, this scraper delivers accurate, structured transcript data for any video with available captions.

---

### 🎯 What Does This Tool Do?

- Extracts transcripts from YouTube videos using a full URL 
- Supports both auto-generated and manually created captions.
- Outputs transcripts in both JSON and plain text formats for easy integration and analysis.

---

### 🚀 Key Features

- Retrieve transcripts from any YouTube video with captions
- Accepts only full URLs
- Outputs in JSON and plain text
- Includes timestamps for each transcript segment
- Fast and reliable extraction
- Json output for easy intrgration
- Minimal setup required

---

### 🔍 Use Cases

- **Content Creators:** Generate subtitles or repurpose video content.
- **Researchers:** Perform sentiment analysis, NLP, or content analysis.
- **Accessibility:** Provide readable transcripts for hearing-impaired users.
- **SEO & Summarization:** Create searchable summaries and improve discoverability.
- **Education:** Collect lecture or tutorial transcripts for study and reference.

---

### 📥 Inputs

#### What does the scraper accept?

- **YouTube Video URL** (e.g., `https://www.youtube.com/watch?v=dQw4w9WgXcQ`)

> **Note:** The video must have captions enabled (either user-uploaded or auto-generated).

---

### 🔒 Restrictions

- Only works with videos that have available transcripts.
- Some videos (e.g., live streams, private videos) may not provide transcripts.

---

### ✅ Example Input

```json
{
  "videoUrl": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/watch?v=jzEbj3w8bDY"
    ]
}
````

***

### 📤 Outputs

#### What does the scraper return?

- **JSON**: Structured transcript with timestamps and text.
- **Plain Text**: Clean, readable transcript.

##### Example Output (JSON)

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Never Gonna Give You Up",
  "transcript": [
    { "timestamp": "0:00", "text": "We're no strangers to love" },
    { "timestamp": "0:05", "text": "You know the rules and so do I" },
    { "timestamp": "0:10", "text": "A full commitment's what I'm thinking of" }
  ]
}
```

##### Example Output (Plain Text)

```
0:00 We're no strangers to love
0:05 You know the rules and so do I
0:10 A full commitment's what I'm thinking of
```

***

### ⚙️ How to Use

1. Log in or Sign up on [Apify Platform](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: "toggle ON" or    "toggle OFF").
5. Start the task and receive your transcript in JSON format.

***

### 🛠️ Troubleshooting

| Issue                | Possible Cause                        | Solution                        |
|----------------------|---------------------------------------|---------------------------------|
| Transcript not found | Video has no captions                 | Try another video               |
| Invalid URL/ID       | Input is incorrect or missing         | Check and re-enter the input    |
| Empty transcript     | YouTube restricted the transcript     | Try another video or region     |

***

### 🔗 Additional Resources

- [YouTube API Documentation](https://developers.google.com/youtube/v3/docs)
- [Apify Platform](https://apify.com/)
- [My Profile](https://apify.com/vistics)

***

### 🙌 Acknowledgments

This tool was built with the support of the open-source 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("vistics/youtube-transcript-scraper-2-1k-results").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("vistics/youtube-transcript-scraper-2-1k-results").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 vistics/youtube-transcript-scraper-2-1k-results --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=vistics/youtube-transcript-scraper-2-1k-results",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Transcript Scraper. $2/1k results⚡",
        "description": "Extract transcripts from any YouTube video in seconds. \nSupports auto-generated & manual captions, timestamps, \nJSON & plain text output. Perfect for content creators, \nresearchers, SEO & NLP projects. 🎬",
        "version": "0.0",
        "x-build-id": "ArChzqaLdNjpyJwFt"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/vistics~youtube-transcript-scraper-2-1k-results/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-vistics-youtube-transcript-scraper-2-1k-results",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/vistics~youtube-transcript-scraper-2-1k-results/runs": {
            "post": {
                "operationId": "runs-sync-vistics-youtube-transcript-scraper-2-1k-results",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/vistics~youtube-transcript-scraper-2-1k-results/run-sync": {
            "post": {
                "operationId": "run-sync-vistics-youtube-transcript-scraper-2-1k-results",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "timestamps": {
                        "title": "Include timestamps",
                        "type": "boolean",
                        "description": "If true, returns transcript array with timestamps. If false, returns joined text only.",
                        "default": false
                    },
                    "startUrls": {
                        "title": "Start URLs",
                        "type": "array",
                        "description": "List of YouTube video URLs to scrape transcripts from",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
