# Youtube Transcripts (`karamelo/youtube-transcripts`) Actor

Extract 1 transcript or 1000s of YouTube transcripts fast. Save time & effort . Get accurate structured transcripts or captions in seconds for each video & short. Export in various formats,, JSON, XML, HTML, CSV, EXCEL... Boost your productivity!

- **URL**: https://apify.com/karamelo/youtube-transcripts.md
- **Developed by:** [karamelo](https://apify.com/karamelo) (community)
- **Categories:** Videos, Social media, Automation
- **Stats:** 6,805 total users, 927 monthly users, 100.0% runs succeeded, 229 bookmarks
- **User rating**: 4.99 out of 5 stars

## Pricing

from $5.00 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Extraction 🧰

#### Tool Overview  

The YouTube Transcript Scraper is designed to efficiently extract transcripts from YouTube videos 🎥. By inputting a video's URL or 1000s URLs🔗, the tool retrieves the full transcript (when available), providing researchers 👨‍🔬, content creators 🎬, and users with convenient access to textual video content 📝. 
The tool works well with both, long videos and shorts videos.

#### Update:(09-23-2024)
You can now choose option output for the format to extract transcripts/captions: 
- The default output format is captions array **with text only**
- captions array **text with timestamps**
- captions in **XML only**
- captions in **XML with timestamps**
- captions in **one line string text** 
#### Update:(09-27-2024)
- Improved speed
- Better error handling
#### Update:(11-26-2024)
- Intermediate results are not lost. Even when the Actor's run is aborted or stops running or timedout.
- Bug fix

#### Update:(03-06-2025) added 14 data points to include in the results:  
-   Channel Handle  
-   Channel Name  
-   Channel ID  
-   Subscriber Count  
-   Date Text: example feb 2, 2025  
-   Relative Date Text: example 3 days ago  
-   Date Published: in ISO format  
-   Upload Date: in ISO format     
-   View Count: number of views  
-   Likes: number of likes  
-   Comments: number of comments  
-   Keywords or Tags
-   Thumbnail url
-   Description  
  

#### Key Functionality ⭐

* **Streamlined User Experience:**  Transcript retrieval is initiated through the simple input of the YouTube video URL or URLs – easy peasy! 🎉
* **Rapid Data Retrieval:**  The tool swiftly fetches the transcript associated with the provided URL ⚡. No waiting around!
* **Clear Text Output:**  The extracted transcript is presented in a clean, readable plain text format, facilitating immediate use and analysis 👌.
* **Works for Shorts Videos:** You can also extract transcripts from shorts videos, but you know, most of shorts do not contain transcripts or captions.

#### How to Use ⚙️

1. **URL Input:** 
    * Identify the target YouTube video 🎥.
    * Copy the video's URL or URLs from the browser address bar. 
2. **Tool Initiation:**
    * Access the YouTube Transcript Scraper tool input page.
    * Paste the copied URL or URLs into the designated input field.
    * Choose your desired captions/transcript output format (Text only, with timestamps...)
    * Retries count: How many times to retry a failed request. default is 3 times.
    * Click Start and sit back.
3. **Transcript Retrieval:**
    * Wait for extraction to finish.
    * Initiate the extraction process by clicking "Export". ✨
4. **Transcript Access:**
    * The extracted transcript will be displayed on screen  짠!
    * You can copy the text directly or download it as a .json .html table .xml .xlsx .csv file for future reference 💾.

#### Illustrative Example 

**Step-by-Step Guide**

1. **Video Selection:** Locate the desired video on the YouTube platform 🔍.
2. **URL Acquisition:** Copy the video URL (e.g., https://www.youtube.com/watch?v=dQw4w9WgXcQ). 
3. **Transcript Extraction:** Input the URL into the YouTube Transcript Scraper and click "Start".  
4. **Transcript Utilization:** Proceed to view, copy, or download the retrieved transcript – it's yours! 🎉

**Example Output Text Array Structure:**

````json
{
    "videoId": "dQw4w9WgXcQ",
    "captions":
        [
"\[FILM PROJECTOR ROLLING\]",
"♪ WAIT ‘TIL I TURN MY LOVE ON ♪",
"♪ WAIT ‘TIL, WAIT ‘TIL ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON ♪",
"♪ I’M NO CHEAP THRILL ♪",
"♪ I’M A ROLLERCOASTER RIDE, BABY JUMP ON ♪",
"♪ COME ON, COME ON ♪",
"♪ CAUSE BABY IF YOU CAN’T TELL (CAUSE BABY IF YOU CAN’T TELL) ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON, OHH ♪",
"♪ THIS DOESN’T HAVE TO BE SOME SORT OF MATHEMATICAL EQUATION ♪",
"♪ SLIP OFF YOUR JEANS, SLIDE IN THE SHEETS ♪",
"♪ SCREAMING “YES” IN QUOTATIONS ♪",
"♪ CLOCK IN, BABY GET TO WORK ♪",
"♪ NIGHT SHIFT BUT WITH ALL THE PERKS ♪",
"♪ TIME STAMPING WHEN YOU FELL IN LOVE ♪",
"♪ TIME CAN’T MESS WITH US ♪",
"♪ OOOH, OOOH, OOOH ♪",
"♪ IF YOU THINK ABOUT FALLING ♪",
"♪ GOT YOU COVERED LIKE GARMENTS ♪",
"♪ OOOH, OOOH, OOOH ♪",
"♪ I DESERVE AN APPLAUSE FOR ♪",
"♪ KEEPING YOU UP LATE ‘TIL YOU",
"CAN’T SEE STRAIGHT JUST WAIT, WOO! ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON ♪",
"♪ WAIT ‘TIL, WAIT ‘TIL ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON (WAIT ‘TIL I TURN MY LOVE ON) ♪",
"♪ I’M NO CHEAP THRILL ♪",
"♪ I’M A ROLLER COASTER RIDE, BABY JUMP ON ♪",
"♪ COME ON COME ON ♪",
"♪ CAUSE BABY IF YOU CAN’T TELL (CAUSE BABY IF YOU CAN’T TELL) ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON, OHH! ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON (WAIT ‘TIL I TURN MY LOVE ON) ♪",
"♪ WAIT ‘TIL WAIT TILL ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON ♪",
"♪ YOU’LL GET YOUR THRILL ♪",
"♪ JUST PROMISE YOU’LL BE PATIENT WITH THE OUTCOME ♪",
"♪ COME ON ♪",
"♪ CAUSE BABY IF YOU CAN’T TELL (CAUSE BABY IF YOU CAN’T TELL) ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON ♪",
"♪ WHY WE CONVERSING OVER THIS STEAK TARTARE WHEN WE COULD BE ♪",
"♪ SOMEWHERE OTHER THAN HERE MAKING OUT IN THE BACK OF A CAR ♪",
"♪ OR IN THE BACK OF A BAR ♪",
"♪ OR WE COULD MAKE A MEMOIR, YEAH ♪",
"♪ ON THE BACK WALL OF THE LAST STALL IN THE BATHROOM AT THE BAZAAR ♪",
"♪ OOOH, OOOH, OOOH ♪",
"♪ IF YOU THINK ABOUT FALLING ♪",
"♪ GOT YOU COVERED LIKE GARMENTS ♪",
"♪ OOOH, OOOH, OOOH ♪",
"♪ I DESERVE AN APPLAUSE FOR ♪",
"♪ KEEPING YOU UP LATE ‘TIL YOU",
"CAN’T SEE STRAIGHT JUST WAIT, WOO! ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON ♪",
"♪ WAIT ‘TIL, WAIT ‘TIL ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON (WAIT ‘TIL I TURN MY LOVE ON) ♪",
"♪ I’M NO CHEAP THRILL ♪",
"♪ I’M A ROLLER COASTER RIDE, BABY JUMP ON ♪",
"♪ COME ON COME ON ♪",
"♪ CAUSE BABY IF YOU CAN’T TELL (CAUSE BABY IF YOU CAN’T TELL) ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON, OHH! ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON (WAIT ‘TIL I TURN MY LOVE ON) ♪",
"♪ WAIT ‘TIL, WAIT ‘TIL ♪",
"♪ WAIT ‘TIL I TURN MY LOVE ON (WAIT ‘TIL I TURN MY LOVE ON) ♪",
"♪ YOU’LL GET YOUR THRILL ♪",
"♪ JUST PROMISE YOU’LL BE PATIENT WITH THE OUTCOME ♪",
"♪ COME ON ♪",
"♪ CAUSE BABY IF YOU CAN’T TELL (CAUSE BABY IF YOU CAN’T TELL) ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON ♪",
"♪ WAIT ‘TIL I ♪",
"♪ OHH YEAH ♪",
"♪ WAIT ‘TIL I ♪",
"♪♪♪ \[VOCALIZING\]",
"♪ BABY IF YOU CAN’T TELL ♪",
"♪ YOU’RE WHAT I WANNA LOVE ON, OHH! ♪",
"SILENCE (FRENCH) SILENZIO (ITALIAN)",
"♪♪♪"
]
}
`````

**Example Output Text Array with Timestamps Structure:**

```json
{
"videoId": "mNHNktxbjdk",
"captions": [
{
"start": 0.667,
"end": 3.17,
"text": "[FILM PROJECTOR ROLLING]"
},
{
"start": 6.84,
"end": 8.383,
"text": "<i>- QU’EST-CE QUE JE VAIS TE\nNOMMER? </i>[FRENCH]"
},
{
"start": 10.052,
"end": 11.386,
"text": "<i>JE VAIS TE NOMMER</i>"
},
{
"start": 11.47,
"end": 13.013,
"text": "<i>L’AMOUR</i>"
},
{
"start": 13.513,
"end": 16.225,
"text": "<i>L’AMOUR TENDRE</i>"
},
{
"start": 16.308,
"end": 18.185,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON ♪"
},
{
"start": 19.144,
"end": 20.27,
"text": "♪ WAIT ‘TIL, WAIT ‘TIL ♪"
},
{
"start": 20.354,
"end": 22.189,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON ♪"
},
{
"start": 23.523,
"end": 24.691,
"text": "♪ I’M NO CHEAP THRILL ♪"
},
{
"start": 24.775,
"end": 27.360999999999997,
"text": "♪ I’M A ROLLERCOASTER RIDE,\nBABY JUMP ON ♪"
},
{
"start": 27.819,
"end": 28.987,
"text": "♪ COME ON, COME ON ♪"
},
{
"start": 29.071,
"end": 31.240000000000002,
"text": "♪ CAUSE BABY IF YOU CAN’T TELL\n(CAUSE BABY IF YOU CAN’T TELL) ♪"
},
{
"start": 31.24,
"end": 33.533,
"text": "♪ YOU’RE WHAT I\nWANNA LOVE ON, OHH ♪"
},
{
"start": 33.617,
"end": 37.745999999999995,
"text": "♪ THIS DOESN’T HAVE TO BE SOME\nSORT OF MATHEMATICAL EQUATION ♪"
},
{
"start": 37.829,
"end": 39.873,
"text": "♪ SLIP OFF YOUR JEANS,\nSLIDE IN THE SHEETS ♪"
},
{
"start": 39.957,
"end": 41.875,
"text": "♪ SCREAMING “YES”\nIN QUOTATIONS ♪"
},
{
"start": 41.959,
"end": 43.919000000000004,
"text": "♪ CLOCK IN, BABY GET TO WORK ♪"
},
{
"start": 44.002,
"end": 46.088,
"text": "♪ NIGHT SHIFT BUT WITH ALL\nTHE PERKS ♪"
},
{
"start": 46.171,
"end": 48.048,
"text": "♪ TIME STAMPING WHEN YOU FELL\nIN LOVE ♪"
},
{
"start": 48.131,
"end": 49.925,
"text": "♪ TIME CAN’T MESS WITH US ♪"
},
{
"start": 50.008,
"end": 52.844,
"text": "♪ OOOH, OOOH, OOOH ♪"
},
{
"start": 52.928,
"end": 54.638,
"text": "♪ IF YOU THINK ABOUT FALLING ♪"
},
{
"start": 54.721,
"end": 57.181999999999995,
"text": "♪ GOT YOU COVERED LIKE\nGARMENTS ♪"
},
{
"start": 57.266,
"end": 61.019,
"text": "♪ OOOH, OOOH, OOOH ♪"
},
{
"start": 61.103,
"end": 62.938,
"text": "♪ I DESERVE AN APPLAUSE FOR ♪"
},
{
"start": 63.021,
"end": 66.441,
"text": "♪ KEEPING YOU UP LATE ‘TIL YOU"
},
{
"start": 63.021,
"end": 66.441,
"text": "CAN’T SEE STRAIGHT\nJUST WAIT, WOO! ♪"
},
{
"start": 66.525,
"end": 69.069,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON ♪"
},
{
"start": 69.152,
"end": 70.529,
"text": "♪ WAIT ‘TIL, WAIT ‘TIL ♪"
},
{
"start": 70.612,
"end": 73.03099999999999,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON\n(WAIT ‘TIL I TURN MY LOVE ON) ♪"
},
{
"start": 73.115,
"end": 74.366,
"text": "♪ I’M NO CHEAP THRILL ♪"
},
{
"start": 74.449,
"end": 77.244,
"text": "♪ I’M A ROLLER COASTER RIDE,\nBABY JUMP ON ♪"
},
{
"start": 77.327,
"end": 78.41199999999999,
"text": "♪ COME ON COME ON ♪"
},
{
"start": 78.495,
"end": 80.622,
"text": "♪ CAUSE BABY IF YOU CAN’T TELL\n(CAUSE BABY IF YOU CAN’T TELL) ♪"
},
{
"start": 80.706,
"end": 83.083,
"text": "♪ YOU’RE WHAT I WANNA LOVE ON,\nOHH! ♪"
},
{
"start": 83.166,
"end": 85.669,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON\n(WAIT ‘TIL I TURN MY LOVE ON) ♪"
},
{
"start": 85.752,
"end": 86.71199999999999,
"text": "♪ WAIT ‘TIL WAIT TILL ♪"
},
{
"start": 86.712,
"end": 88.797,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON ♪"
},
{
"start": 89.923,
"end": 90.924,
"text": "♪ YOU’LL GET YOUR THRILL ♪"
},
{
"start": 91.008,
"end": 93.55199999999999,
"text": "♪ JUST PROMISE YOU’LL BE PATIENT\nWITH THE OUTCOME ♪"
},
{
"start": 94.136,
"end": 95.012,
"text": "♪ COME ON ♪"
},
{
"start": 95.095,
"end": 97.264,
"text": "♪ CAUSE BABY IF YOU CAN’T TELL\n(CAUSE BABY IF YOU CAN’T TELL) ♪"
},
{
"start": 97.264,
"end": 99.01599999999999,
"text": "♪ YOU’RE WHAT I WANNA LOVE ON ♪"
},
{
"start": 99.391,
"end": 103.52000000000001,
"text": "♪ WHY WE CONVERSING OVER THIS\nSTEAK TARTARE WHEN WE COULD BE ♪"
},
{
"start": 103.895,
"end": 107.149,
"text": "♪ SOMEWHERE OTHER THAN HERE\nMAKING OUT IN THE BACK OF\nA CAR ♪"
},
{
"start": 107.232,
"end": 109.359,
"text": "♪ OR IN THE BACK OF A BAR ♪"
},
{
"start": 109.443,
"end": 111.90299999999999,
"text": "♪ OR WE COULD MAKE\nA MEMOIR, YEAH ♪"
},
{
"start": 111.987,
"end": 115.198,
"text": "♪ ON THE BACK WALL OF THE LAST\nSTALL IN THE BATHROOM AT\nTHE BAZAAR ♪"
},
{
"start": 115.282,
"end": 118.827,
"text": "♪ OOOH, OOOH, OOOH ♪"
},
{
"start": 118.91,
"end": 120.871,
"text": "♪ IF YOU THINK ABOUT FALLING ♪"
},
{
"start": 120.954,
"end": 123.457,
"text": "♪ GOT YOU COVERED LIKE\nGARMENTS ♪"
},
{
"start": 123.874,
"end": 127.294,
"text": "♪ OOOH, OOOH, OOOH ♪"
},
{
"start": 127.377,
"end": 129.004,
"text": "♪ I DESERVE AN APPLAUSE FOR ♪"
},
{
"start": 129.087,
"end": 132.38199999999998,
"text": "♪ KEEPING YOU UP LATE ‘TIL YOU"
},
{
"start": 129.087,
"end": 132.38199999999998,
"text": "CAN’T SEE STRAIGHT\nJUST WAIT, WOO! ♪"
},
{
"start": 132.466,
"end": 134.30100000000002,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON ♪"
},
{
"start": 135.26,
"end": 136.261,
"text": "♪ WAIT ‘TIL, WAIT ‘TIL ♪"
},
{
"start": 136.345,
"end": 139.389,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON\n(WAIT ‘TIL I TURN MY LOVE ON) ♪"
},
{
"start": 139.473,
"end": 140.68200000000002,
"text": "♪ I’M NO CHEAP THRILL ♪"
},
{
"start": 140.766,
"end": 142.976,
"text": "♪ I’M A ROLLER COASTER RIDE,\nBABY JUMP ON ♪"
},
{
"start": 143.435,
"end": 144.561,
"text": "♪ COME ON COME ON ♪"
},
{
"start": 144.644,
"end": 146.81300000000002,
"text": "♪ CAUSE BABY IF YOU CAN’T TELL\n(CAUSE BABY IF YOU CAN’T TELL) ♪"
},
{
"start": 146.813,
"end": 149.149,
"text": "♪ YOU’RE WHAT I WANNA LOVE ON,\nOHH! ♪"
},
{
"start": 149.232,
"end": 151.86,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON\n(WAIT ‘TIL I TURN MY LOVE ON) ♪"
},
{
"start": 151.943,
"end": 152.98600000000002,
"text": "♪ WAIT ‘TIL, WAIT ‘TIL ♪"
},
{
"start": 153.07,
"end": 155.697,
"text": "♪ WAIT ‘TIL I TURN MY LOVE ON\n(WAIT ‘TIL I TURN MY LOVE ON) ♪"
},
{
"start": 155.781,
"end": 157.115,
"text": "♪ YOU’LL GET YOUR THRILL ♪"
},
{
"start": 157.199,
"end": 159.40900000000002,
"text": "♪ JUST PROMISE YOU’LL BE PATIENT\nWITH THE OUTCOME ♪"
},
{
"start": 160.744,
"end": 161.411,
"text": "♪ COME ON ♪"
},
{
"start": 161.411,
"end": 163.58,
"text": "♪ CAUSE BABY IF YOU CAN’T TELL\n(CAUSE BABY IF YOU CAN’T TELL) ♪"
},
{
"start": 163.58,
"end": 164.99800000000002,
"text": "♪ YOU’RE WHAT I WANNA LOVE ON ♪"
},
{
"start": 165.332,
"end": 167,
"text": "♪ WAIT ‘TIL I ♪"
},
{
"start": 168.502,
"end": 169.79500000000002,
"text": "♪ OHH YEAH ♪"
},
{
"start": 169.878,
"end": 171.588,
"text": "♪ WAIT ‘TIL I ♪"
},
{
"start": 171.922,
"end": 178.136,
"text": "♪♪♪\n[VOCALIZING]"
},
{
"start": 178.22,
"end": 179.846,
"text": "♪ BABY IF YOU CAN’T TELL ♪"
},
{
"start": 179.93,
"end": 182.26500000000001,
"text": "♪ YOU’RE WHAT I WANNA LOVE ON,\nOHH! ♪"
},
{
"start": 184.309,
"end": 186.478,
"text": "SILENCE (FRENCH)\nSILENZIO (ITALIAN)"
},
{
"start": 186.937,
"end": 188.77200000000002,
"text": "♪♪♪"
}
]
```

#### Potential Issues & Resolutions 🛠️

- **Youtube scraping Errors:** More than before YouTube blocks a lot of requests, if this is the case, increase number of retries in the input page and/or change proxy to Residential.
- **Transcript Unavailability:** The tool will notify users if a transcript is not available for the specified video 😔.
- **URL Errors:** Ensure the accuracy and validity of the inputted YouTube URL to avoid retrieval errors – double-check that link! We are making a lot of URL validity check and cleaning to make it suitable for the code to work well, but you never know, please check twice so you don't loose your time.

#### Support & Assistance 🙋‍♀️

For technical assistance or inquiries, please infome me in the issues tab.

#### Further Resources ➡️

**We encourage you to leverage the YouTube Transcript Scraper for efficient and effective access to valuable video content!** 😄

# Actor input Schema

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

Select the format in which you want your captions

## `urls` (type: `array`):

The URLs of the videos you want to extract the transcript/captions from. Each URL must be a valid YouTube video link.

## `maxRetries` (type: `integer`):

Maximum number requests to retry if your get blocked, increase for better chance

## `channelNameBoolean` (type: `boolean`):

Indicates whether the channel Name should be included.

## `channelIDBoolean` (type: `boolean`):

Indicates whether the channel ID should be included.

## `dateTextBoolean` (type: `boolean`):

Indicates whether the formatted date (Feb 7, 2025) should be included.

## `relativeDateTextBoolean` (type: `boolean`):

Indicates whether the relative date (example 3 days ago) should be included.

## `datePublishedBoolean` (type: `boolean`):

Indicates whether the full date and time the video was published (example 2025-02-07T07:00:15.000Z) should be included.

## `viewCountBoolean` (type: `boolean`):

Indicates whether the view count (example 69,916 views) should be included.

## `likesBoolean` (type: `boolean`):

Indicates whether the number of likes (example 4.8K) should be included.

## `commentsBoolean` (type: `boolean`):

Indicates whether the number of comments (example 456) should be included.

## `keywordsBoolean` (type: `boolean`):

Indicates whether the keywords (or tags) should be included.

## `thumbnailBoolean` (type: `boolean`):

Indicates whether the thumbnail url should be included.

## `descriptionBoolean` (type: `boolean`):

Indicates whether the video description should be included.

## `proxyOptions` (type: `object`):

Select proxies to be used by your actor.

## Actor input object example

```json
{
  "outputFormat": "captions",
  "urls": [
    "https://www.youtube.com/watch?v=b_nep8vMnkc",
    "https://www.youtube.com/watch?v=mNHNktxbjdk"
  ],
  "maxRetries": 8,
  "channelNameBoolean": true,
  "channelIDBoolean": true,
  "dateTextBoolean": false,
  "relativeDateTextBoolean": false,
  "datePublishedBoolean": true,
  "viewCountBoolean": false,
  "likesBoolean": false,
  "commentsBoolean": false,
  "keywordsBoolean": false,
  "thumbnailBoolean": false,
  "descriptionBoolean": false,
  "proxyOptions": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "BUYPROXIES94952"
    ]
  }
}
```

# 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 = {
    "urls": [
        "https://www.youtube.com/watch?v=b_nep8vMnkc",
        "https://www.youtube.com/watch?v=mNHNktxbjdk"
    ],
    "maxRetries": 8,
    "proxyOptions": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "BUYPROXIES94952"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("karamelo/youtube-transcripts").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 = {
    "urls": [
        "https://www.youtube.com/watch?v=b_nep8vMnkc",
        "https://www.youtube.com/watch?v=mNHNktxbjdk",
    ],
    "maxRetries": 8,
    "proxyOptions": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["BUYPROXIES94952"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("karamelo/youtube-transcripts").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 '{
  "urls": [
    "https://www.youtube.com/watch?v=b_nep8vMnkc",
    "https://www.youtube.com/watch?v=mNHNktxbjdk"
  ],
  "maxRetries": 8,
  "proxyOptions": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "BUYPROXIES94952"
    ]
  }
}' |
apify call karamelo/youtube-transcripts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=karamelo/youtube-transcripts",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Transcripts",
        "description": "Extract 1 transcript or 1000s of YouTube transcripts fast. Save time & effort . Get accurate structured transcripts or captions in seconds for each video & short. Export in various formats,, JSON, XML, HTML, CSV, EXCEL... Boost your productivity!",
        "version": "0.0",
        "x-build-id": "kd4MuHgA1bMqIYMO8"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/karamelo~youtube-transcripts/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-karamelo-youtube-transcripts",
                "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/karamelo~youtube-transcripts/runs": {
            "post": {
                "operationId": "runs-sync-karamelo-youtube-transcripts",
                "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/karamelo~youtube-transcripts/run-sync": {
            "post": {
                "operationId": "run-sync-karamelo-youtube-transcripts",
                "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": [
                    "urls"
                ],
                "properties": {
                    "outputFormat": {
                        "title": "Select output format",
                        "enum": [
                            "captions",
                            "textWithTimestamps",
                            "xmlWithoutTimestamps",
                            "xmlWithTimestamps",
                            "singleStringText"
                        ],
                        "type": "string",
                        "description": "Select the format in which you want your captions",
                        "default": "captions"
                    },
                    "urls": {
                        "title": "URL(s) for the Video(s)",
                        "type": "array",
                        "description": "The URLs of the videos you want to extract the transcript/captions from. Each URL must be a valid YouTube video link.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxRetries": {
                        "title": "Maximum retries.",
                        "minimum": 3,
                        "maximum": 12,
                        "type": "integer",
                        "description": "Maximum number requests to retry if your get blocked, increase for better chance",
                        "default": 8
                    },
                    "channelNameBoolean": {
                        "title": "Channel Name",
                        "type": "boolean",
                        "description": "Indicates whether the channel Name should be included.",
                        "default": true
                    },
                    "channelIDBoolean": {
                        "title": "Channel ID",
                        "type": "boolean",
                        "description": "Indicates whether the channel ID should be included.",
                        "default": true
                    },
                    "dateTextBoolean": {
                        "title": "Date Text",
                        "type": "boolean",
                        "description": "Indicates whether the formatted date (Feb 7, 2025) should be included.",
                        "default": false
                    },
                    "relativeDateTextBoolean": {
                        "title": "Relative Date Text",
                        "type": "boolean",
                        "description": "Indicates whether the relative date (example 3 days ago) should be included.",
                        "default": false
                    },
                    "datePublishedBoolean": {
                        "title": "Date Published",
                        "type": "boolean",
                        "description": "Indicates whether the full date and time the video was published (example 2025-02-07T07:00:15.000Z) should be included.",
                        "default": true
                    },
                    "viewCountBoolean": {
                        "title": "View Count",
                        "type": "boolean",
                        "description": "Indicates whether the view count (example 69,916 views) should be included.",
                        "default": false
                    },
                    "likesBoolean": {
                        "title": "Likes",
                        "type": "boolean",
                        "description": "Indicates whether the number of likes (example 4.8K) should be included.",
                        "default": false
                    },
                    "commentsBoolean": {
                        "title": "Comments",
                        "type": "boolean",
                        "description": "Indicates whether the number of comments (example 456) should be included.",
                        "default": false
                    },
                    "keywordsBoolean": {
                        "title": "Keywords",
                        "type": "boolean",
                        "description": "Indicates whether the keywords (or tags) should be included.",
                        "default": false
                    },
                    "thumbnailBoolean": {
                        "title": "Thumbnail",
                        "type": "boolean",
                        "description": "Indicates whether the thumbnail url should be included.",
                        "default": false
                    },
                    "descriptionBoolean": {
                        "title": "Description",
                        "type": "boolean",
                        "description": "Indicates whether the video description should be included.",
                        "default": false
                    },
                    "proxyOptions": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Select proxies to be used by your actor."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
