Node.js
import { Supadata } from '@supadata/js';
const supadata = new Supadata({
apiKey: 'YOUR_API_KEY',
});
const transcriptBatch = await supadata.youtube.transcript.batch({
videoIds: ['dQw4w9WgXcQ', 'xvFZjo5PgG0'],
// playlistId: 'PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' // alternatively
// channelId: 'UC_9-kyTW8ZkZNDHQJ6FgpwQ' // alternatively
lang: 'en',
text: true
});
console.log(`Started transcript batch job: ${transcriptBatch.jobId}`);from supadata import Supadata, SupadataError
supadata = Supadata(api_key="YOUR_API_KEY")
transcript_batch = supadata.youtube.transcript.batch(
video_ids=["dQw4w9WgXcQ", "xvFZjo5PgG0"],
# playlist_id="PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc" # alternatively
# channel_id="UC_9-kyTW8ZkZNDHQJ6FgpwQ" # alternatively
lang="en",
text=True
)
print(f"Started transcript batch job: {transcript_batch.job_id}")curl -X POST "https://api.supadata.ai/v1/youtube/transcript/batch" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"videoIds": ["dQw4w9WgXcQ", "xvFZjo5PgG0"],
"lang": "en",
"text": true
}'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoIds: ['dQw4w9WgXcQ', 'https://www.youtube.com/watch?v=xvFZjo5PgG0'],
playlistId: '<string>',
channelId: '<string>',
limit: 20,
lang: 'en',
text: false
})
};
fetch('https://api.supadata.ai/v1/youtube/transcript/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.supadata.ai/v1/youtube/transcript/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'videoIds' => [
'dQw4w9WgXcQ',
'https://www.youtube.com/watch?v=xvFZjo5PgG0'
],
'playlistId' => '<string>',
'channelId' => '<string>',
'limit' => 20,
'lang' => 'en',
'text' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.supadata.ai/v1/youtube/transcript/batch"
payload := strings.NewReader("{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.supadata.ai/v1/youtube/transcript/batch")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.supadata.ai/v1/youtube/transcript/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}"
response = http.request(request)
puts response.read_body{
"jobId": "123e4567-e89b-12d3-a456-426614174000"
}{
"error": "invalid-request",
"message": "Invalid Request",
"details": "The request is invalid or malformed",
"documentationUrl": "https://supadata.ai/documentation/errors#invalid-request"
}{
"error": "invalid-request",
"message": "Invalid Request",
"details": "The request is invalid or malformed",
"documentationUrl": "https://supadata.ai/documentation/errors#invalid-request"
}YouTube Endpoints
Transcript Batch
Create a batch job to get transcripts of multiple YouTube videos
POST
/
youtube
/
transcript
/
batch
Node.js
import { Supadata } from '@supadata/js';
const supadata = new Supadata({
apiKey: 'YOUR_API_KEY',
});
const transcriptBatch = await supadata.youtube.transcript.batch({
videoIds: ['dQw4w9WgXcQ', 'xvFZjo5PgG0'],
// playlistId: 'PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' // alternatively
// channelId: 'UC_9-kyTW8ZkZNDHQJ6FgpwQ' // alternatively
lang: 'en',
text: true
});
console.log(`Started transcript batch job: ${transcriptBatch.jobId}`);from supadata import Supadata, SupadataError
supadata = Supadata(api_key="YOUR_API_KEY")
transcript_batch = supadata.youtube.transcript.batch(
video_ids=["dQw4w9WgXcQ", "xvFZjo5PgG0"],
# playlist_id="PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc" # alternatively
# channel_id="UC_9-kyTW8ZkZNDHQJ6FgpwQ" # alternatively
lang="en",
text=True
)
print(f"Started transcript batch job: {transcript_batch.job_id}")curl -X POST "https://api.supadata.ai/v1/youtube/transcript/batch" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"videoIds": ["dQw4w9WgXcQ", "xvFZjo5PgG0"],
"lang": "en",
"text": true
}'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
videoIds: ['dQw4w9WgXcQ', 'https://www.youtube.com/watch?v=xvFZjo5PgG0'],
playlistId: '<string>',
channelId: '<string>',
limit: 20,
lang: 'en',
text: false
})
};
fetch('https://api.supadata.ai/v1/youtube/transcript/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.supadata.ai/v1/youtube/transcript/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'videoIds' => [
'dQw4w9WgXcQ',
'https://www.youtube.com/watch?v=xvFZjo5PgG0'
],
'playlistId' => '<string>',
'channelId' => '<string>',
'limit' => 20,
'lang' => 'en',
'text' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.supadata.ai/v1/youtube/transcript/batch"
payload := strings.NewReader("{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.supadata.ai/v1/youtube/transcript/batch")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.supadata.ai/v1/youtube/transcript/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"videoIds\": [\n \"dQw4w9WgXcQ\",\n \"https://www.youtube.com/watch?v=xvFZjo5PgG0\"\n ],\n \"playlistId\": \"<string>\",\n \"channelId\": \"<string>\",\n \"limit\": 20,\n \"lang\": \"en\",\n \"text\": false\n}"
response = http.request(request)
puts response.read_body{
"jobId": "123e4567-e89b-12d3-a456-426614174000"
}{
"error": "invalid-request",
"message": "Invalid Request",
"details": "The request is invalid or malformed",
"documentationUrl": "https://supadata.ai/documentation/errors#invalid-request"
}{
"error": "invalid-request",
"message": "Invalid Request",
"details": "The request is invalid or malformed",
"documentationUrl": "https://supadata.ai/documentation/errors#invalid-request"
}Authorizations
Body
application/json
- Option 1
- Option 2
- Option 3
Array of YouTube video IDs or URLs
Example:
[
"dQw4w9WgXcQ",
"https://www.youtube.com/watch?v=xvFZjo5PgG0"
]
YouTube playlist URL or ID. See supported URL formats.
Examples:
"https://www.youtube.com/playlist?list=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
"PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc"
YouTube channel URL, handle or ID. See supported URL formats.
Examples:
"https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw"
"https://youtube.com/c/rickastley"
"UCuAXFkgsw1L7xaCfnd5JJOw"
"@rickastley"
"rickastley"
Maximum number of videos to process (when using playlistId or channelId)
Required range:
1 <= x <= 5000Example:
20
When true, returns plain text transcript.
Response
Successfully created a batch job
The ID of the job
Example:
"123e4567-e89b-12d3-a456-426614174000"
Was this page helpful?
⌘I