π― Getting Started with YouTube Transcript Pro
Welcome to the YouTube Transcript Pro API! This guide will show you how to quickly extract high-quality, AI-ready text from any YouTube video in seconds.
π Looking for a no-code solution? Try our official free web tool: YouTube Transcript Generator
π Why use our API?
Most scraping tools return dirty HTML or fragmented sentences that break LLM tokenizers. Our API provides:
transcript: A beautifully concatenated, single string of text β perfect for feeding directly into ChatGPT, Claude, or your custom RAG pipelines.structured_transcript: A clean JSON array containing individual text blocks, ideal if you need to build custom video players or subtitle viewers.
π 1. Authentication
All requests to this API require your unique RapidAPI Key. You do not need to manage tokens yourself. Just ensure these headers are included in every request:
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: youtube-video-transcript-subtitles-pro.p.rapidapi.com
π οΈ 2. The /transcript Endpoint (GET)
This single endpoint handles everything. You can pass either a clean Video ID, or just dump a messy YouTube URL into the parameters.
Base URL: https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
videoId | string | No* | The 11-character YouTube ID (e.g., dQw4w9WgXcQ). |
url | string | No* | Any valid YouTube URL (e.g., https://youtu.be/dQw4w9WgXcQ?t=43). |
lang | string | No | The language code. Defaults to en. Use vi for Vietnamese or other ISO codes. |
Note: You must provide EITHER
videoIdORurl.
π» 3. Code Examples
Leverage the API in any environment. Click to expand your desired programming language below:
π cURL (Terminal)
curl --request GET \
--url 'https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript?videoId=dQw4w9WgXcQ&lang=en' \
--header 'X-RapidAPI-Host: youtube-video-transcript-subtitles-pro.p.rapidapi.com' \
--header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY'π Node.js (Axios)
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript',
params: { videoId: 'dQw4w9WgXcQ', lang: 'en' },
headers: {
'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
'X-RapidAPI-Host': 'youtube-video-transcript-subtitles-pro.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data.transcript);
} catch (error) {
console.error(error);
}π Python (Requests)
import requests
url = "https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript"
querystring = {"videoId": "dQw4w9WgXcQ", "lang": "en"}
headers = {
"X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
"X-RapidAPI-Host": "youtube-video-transcript-subtitles-pro.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
data = response.json()
print(data.get("transcript"))π PHP (cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript?videoId=dQw4w9WgXcQ&lang=en",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-RapidAPI-Host: youtube-video-transcript-subtitles-pro.p.rapidapi.com",
"X-RapidAPI-Key: YOUR_RAPIDAPI_KEY"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}β‘ 4. No-Code Integrations
You can easily plug this API into your favorite automation platforms seamlessly.
π€ n8n Integration Setup
- Add an HTTP Request node to your workflow.
- Set Method to
GET. - Set URL to
https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript. - Under Authentication, select
None(weβll use headers). - Add to Send Headers:
- Name:
X-RapidAPI-Key| Value:YOUR_RAPIDAPI_KEY - Name:
X-RapidAPI-Host| Value:youtube-video-transcript-subtitles-pro.p.rapidapi.com
- Name:
- Add to Send Query Parameters:
- Name:
videoId| Value:dQw4w9WgXcQ(or dynamic expression from previous node)
- Name:
- Execute the node. The response will instantly output clean JSON!
Make.com (Integromat) Setup
- Add the standard HTTP - Make a request module.
- Set URL to
https://youtube-video-transcript-subtitles-pro.p.rapidapi.com/transcript. - Check the box for Show advanced settings.
- In the Headers array, add two items:
- Key:
X-RapidAPI-Key| Value:YOUR_RAPIDAPI_KEY - Key:
X-RapidAPI-Host| Value:youtube-video-transcript-subtitles-pro.p.rapidapi.com
- Key:
- In Query String, add the keys
videoIdandlangwith the desired values. - Set Parse response to
Yes. - Run the module to automatically map the
transcriptvariable to downstream apps!
β οΈ 5. Error Handling
| Status Code | Description | Solution |
|---|---|---|
200 | Success | Data retrieved successfully. |
400 | Bad Request | Invalid url or videoId. |
404 | Not Found | The video does not exist, is private, or has subtitles disabled. |
429 | Too Many Requests | Rate limit exceeded. |
500 | Server Error | YouTube change detected. Try again later. |
π‘ 5. Best Practices for Developers
π§ Caching is your friend: If you are building a wrapper application, cache the
transcriptresponse in your own database (e.g., Redis or PostgreSQL) using thevideoIdas the primary key. This saves your API quota!
π§ Handling Long Videos: For podcasts over 2 hours long, the
transcriptstring can be massive. Ensure your applicationβs memory can handle large JSON unmarshaling.