Blog · · 3 min read
Get a TikTok Transcript With an API
Turn the spoken words of a TikTok video into text with one GET request. Shows the exact fields, the full link format, working code and what to do when it fails.
TikTok videos carry a lot of spoken content that is hard to search or quote. A transcript turns it into text. This guide shows how to get one from a video link, what the answer contains, and how to use it.
Request a transcript
The endpoint takes the full video link as url. Encode it, because it has characters that are special in a web address. Every call needs an API key. New accounts get 100 free credits and a first key is created automatically on sign-up (it is shown once on the dashboard). Sign in at scrapingrabbit.com/login, then send the key in the x-api-key header (a Bearer token also works). The code below reads it from the SCRAPINGRABBIT_API_KEY environment variable, so no key is ever written into your code.
curl -H "x-api-key: $SCRAPINGRABBIT_API_KEY" "https://api.scrapingrabbit.com/v1/tiktok/transcript?url=https%3A%2F%2Fwww.tiktok.com%2F%40mrbeast%2Fvideo%2F7697653789007908126"
Each successful call costs about 5 credits. That is an estimate the team has not measured yet, so see the pricing page for current numbers.
The link has to look like https://www.tiktok.com/@username/video/ followed by the long number. If it does not, the API answers with a 400 status and a message that says the URL must be a TikTok video URL. Failed calls are not charged.
The answer
This is a shortened real answer for a 29 second video:
{
"success": true,
"data": {
"videoId": "7697653789007908126",
"author": "mrbeast",
"description": "It really be like that",
"duration": 29,
"language": "eng-US",
"source": "auto",
"isAutoGenerated": true,
"transcript": [
{ "text": "Gross,", "start": 1.26, "duration": 0.82 },
{ "text": "bro. Keep walking, man.", "start": 2.74, "duration": 1.82 }
],
"text": "Gross, bro. Keep walking, man. Yo, you do content? ...",
"availableLanguages": [{ "language": "eng-US", "source": "auto" }]
}
}
| Field | Meaning |
|---|---|
transcript | The lines, each with text, a start time and a duration, both in seconds |
text | The whole transcript as one block |
language | The language of the captions, such as eng-US |
source and isAutoGenerated | Where the captions came from. auto means TikTok made them by machine. |
availableLanguages | The caption languages offered for this video |
duration | Length of the video in seconds |
In our test the video had 20 lines of captions. The text field already joins them, so you do not have to.
Read it in code
async function tiktokTranscript(videoUrl) {
const url = `https://api.scrapingrabbit.com/v1/tiktok/transcript?url=${encodeURIComponent(videoUrl)}`;
const res = await fetch(url, { headers: { "x-api-key": process.env.SCRAPINGRABBIT_API_KEY } });
const body = await res.json();
if (!body.success) return { ok: false, error: body.message };
return { ok: true, text: body.data.text, lines: body.data.transcript, auto: body.data.isAutoGenerated };
}
const result = await tiktokTranscript("https://www.tiktok.com/@mrbeast/video/7697653789007908126");
console.log(result.ok ? result.text : `No transcript: ${result.error}`);
encodeURIComponent turns the link into a safe query value. The function returns the error message when something goes wrong, so your interface can show it.
In Python the params argument does the encoding for you:
import os
import requests
res = requests.get(
"https://api.scrapingrabbit.com/v1/tiktok/transcript",
params={"url": "https://www.tiktok.com/@mrbeast/video/7697653789007908126"},
headers={"x-api-key": os.environ["SCRAPINGRABBIT_API_KEY"]},
timeout=60,
)
body = res.json()
print(body["data"]["text"] if body["success"] else body["message"])
Turn lines into subtitles
Because each line has a start time and a duration, you can build subtitle timings. The end of a line is start + duration. In the sample above the first line runs from 1.26 to 2.08 seconds. Any subtitle format needs just those two numbers and the text.
Be careful with the text
Automatic captions are a good first draft and no more. Check these before you publish or quote:
- Names and brands. Machines often get them wrong.
- Slang and fast speech. These produce odd words.
- Missing context. Captions leave out music and what is on screen.
Use isAutoGenerated to decide how much checking a transcript needs.
Limits
Each key is limited per minute: 10 requests on the free plan, 60 on Starter, 120 on Pro and 300 on Scale. Every successful call costs credits, so cache each transcript, which never changes for a published video. Not every video will have captions, and a failed request returns success: false with a code and a message. Failed calls and calls where the source has nothing are not charged. Plan for that in your design.
Try it without code
The free TikTok transcript tool works in the browser with no key. It takes a video link and shows the lines with timestamps. You can copy the text with or without them.
Try it yourself
Frequently asked questions
Which link format works?
The full video link, such as https://www.tiktok.com/@username/video/1234567890123456789. Short vm.tiktok.com links are not accepted by our free tool, so open them first and copy the long link.
Are the captions always correct?
No. In our test the source was auto, which means TikTok generated the captions by machine. Names, slang and fast speech can be wrong, so check anything you plan to quote.
What if a video has no transcript?
Check the success field. When it is false, read the message and show your user a note instead of an empty result.