# YouTube transcripts as plain text for RAG and LLMs

**Use case:** 

Plain-text transcripts of YouTube videos, one clean string per video, ready to chunk and embed in a RAG pipeline or to summarise with an LLM. The sample reads three talks with outputFormats set to text only, which keeps the items small; add channels or playlists to build a corpus.

## Input

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=Ks-_Mh1QhMc",
    "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
    "https://www.youtube.com/watch?v=KfODG5REyss"
  ],
  "languages": [],
  "transcriptType": "any",
  "translateTo": "",
  "outputFormats": [
    "text"
  ],
  "includeMetadata": true,
  "maxVideosPerSource": 100,
  "maxVideos": 1000,
  "urlField": ""
}
```

## Output

```json
{
  "video_id": {
    "label": "Video",
    "format": "string"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "title": {
    "label": "Title",
    "format": "string"
  },
  "language_code": {
    "label": "Lang",
    "format": "string"
  },
  "is_generated": {
    "label": "Auto",
    "format": "boolean"
  },
  "snippet_count": {
    "label": "Segments",
    "format": "integer"
  },
  "duration_human": {
    "label": "Length",
    "format": "string"
  },
  "non_timestamped": {
    "label": "Text",
    "format": "string"
  },
  "error_type": {
    "label": "Error type",
    "format": "string"
  },
  "error": {
    "label": "Error",
    "format": "string"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The YouTube Transcript API — Videos, Channels, Playlists, SRT/VTT Actor is ready to run with the inputs already set for "YouTube transcripts as plain text for RAG and LLMs". [Sign up or log in](https://console.apify.com/create-task-from-example/4nXtcVaBkhQOMTMdz) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "YouTube transcripts as plain text for RAG and LLMs" task

The YouTube Transcript API — Videos, Channels, Playlists, SRT/VTT Actor will start running based on the input automatically. You can also change all the input fields, like videos, channels or playlists, preferred languages, and more, to match your specific use case.

### 3. Receive the "YouTube transcripts as plain text for RAG and LLMs" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as video, status, title, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "YouTube transcripts as plain text for RAG and LLMs" task via API](https://apify.com/sherwood/youtube-transcript-batch.md).

## FAQ

### Why does the RAG sample ask for text only?

This RAG transcript task sets outputFormats to text, so non_timestamped holds each transcript as one string without timestamps: smaller items, faster reads, ready to chunk. Add json for timestamps.

### How do I feed a whole YouTube channel into my RAG?

To build a RAG corpus with this transcript task, put a channel @handle in videoUrls with maxVideosPerSource (up to 5,000), schedule the task and deduplicate on video_id when you embed.

### Can an AI agent fetch YouTube transcripts on demand?

Through the Apify MCP server (mcp.apify.com), an agent in Claude, Cursor or ChatGPT can run this YouTube transcript task, fill videoUrls and read the plain-text items back.

### Can I get transcripts in another language for my corpus?

This RAG transcript task returns YouTube's own caption tracks; set languages to pick one. YouTube refused machine translation in every test, so translate non_timestamped with your own LLM step.

## About this Actor

This example demonstrates how to use [YouTube Transcript API — Videos, Channels, Playlists, SRT/VTT](https://apify.com/sherwood/youtube-transcript-batch.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/sherwood/youtube-transcript-batch.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

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 full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/sherwood/youtube-transcript-batch.md

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`).
