If you want the words spoken in 500 TikTok videos, the obvious plan is to download each video and run it through Whisper. It works, and it is wasteful: a large share of TikTok videos already have a transcript sitting in the page, generated by TikTok itself.
This post walks through where those captions live, the traps in picking the right track, and when you actually need speech-to-text. I ended up building this into an Apify actor, which I link at the end. Disclosure: I am the developer.
Where TikTok keeps its captions
Load a public video page, for example https://www.tiktok.com/@nasa/video/7707774305056083213, and look at the HTML. Near the bottom is a script tag:
<script id="__UNIVERSAL_DATA_FOR_REHYDRATION__" type="application/json">{ ... }</script>
That JSON is what the web app hydrates from. Inside it, under the video detail, is an itemStruct with everything the page shows: author, description, hashtags, play counts, duration, and under itemStruct.video two fields that matter here:
-
subtitleInfos: a list of caption tracks. Each has aUrlto a WebVTT file, aLanguageCodeNamelikeeng-US, aFormat, and aSourcesuch asASRorMT. -
claInfo: TikTok's caption metadata. ItscaptionInfosentries say whether each track is the original language and whether it was auto-generated, andoriginalLanguageInfosays what language TikTok thinks is spoken.
Fetch the WebVTT URL, strip the cue timing, and you have the transcript with timestamps. No audio download, no model, about the cost of one extra HTTP request.
Two practical notes. The caption URLs are signed and expire, so fetch them right after the page, not hours later. And TikTok is quick to challenge requests that do not look like a browser; a TLS-impersonating client (I use curl_cffi with Chrome impersonation) gets clean 200s far more often than plain requests.
Trap 1: the Source field lies
The natural rule is "take the track whose Source is ASR, ignore MT (machine translation)." That breaks on real videos.
The NASA video above has exactly one track, eng-US, labeled Source: "MT". By that rule it has no original captions. But claInfo.captionInfos for the same track says isOriginalCaption: true and isAutoGen: false. It is a caption NASA uploaded, in English, in the spoken language. Treating it as a translation would throw away the best transcript on the page.
So I classify tracks from claInfo first and fall back to Source only when claInfo has no matching entry:
- original and auto-generated:
ASR(TikTok's speech recognition) - original and not auto-generated:
CREATOR(uploaded by the creator) - not original:
MT(a translation)
Trap 2: picking the language
A Spanish-language video from @duolingo carries two tracks: spa-ES (original, auto-generated) and eng-US (a translation). If you just take the first English track, you get a machine translation and lose the actual words.
The order I use:
- If the user asked for a language, the matching original track, then a matching translation.
- The track whose language equals
claInfo.originalLanguageInfo.language. - Any track marked original.
- Any
ASRtrack. - Whatever is first.
That gives you the spoken language by default and a translation only when you ask for one.
When there are no captions
Plenty of videos have no tracks. The page tells you, roughly, why: there is a noCaptionReason code, and the music info says whether the audio is an original sound or a licensed track. In my test set, a talking-head video from @garyvee had no captions at all, and neither did a @gordonramsay cooking clip.
For those you do need speech-to-text. The pipeline is short:
- Download the audio (same session as the page fetch, so the CDN accepts it).
- Convert to 16 kHz mono with ffmpeg. That is what Whisper wants and it shrinks the upload.
- Transcribe with a Whisper endpoint that returns segments with timestamps.
- Filter the output. Whisper hallucinates on music and silence ("Thank you for watching" over a dance clip is a classic). If a video is music only, mark it
NO_SPEECHinstead of returning junk.
Only doing step 1 to 4 for videos without captions changes the economics a lot. A captions-first run costs about one page fetch per video. A Whisper run costs one page fetch plus audio, conversion and per-minute model time.
Getting many videos, not one
Three inputs cover most use cases:
-
Video URLs, including
vm.tiktok.comshort links (follow the redirect) and bare numeric IDs. - Profiles: the latest N videos from a username. I use yt-dlp's flat extraction to list a profile's video IDs, then fetch each page myself.
- Another scraper's output: if you already ran a hashtag or search scraper, read the video URLs from its dataset and transcribe those.
At volume, expect a few percent of requests to get challenged. Retry those on a different IP. In my runs, datacenter IPs actually did better than residential ones for TikTok pages, so I start on datacenter and only fall back to residential per video.
What the output looks like
For each video you want the transcript plus enough context to analyze it:
{
"url": "https://www.tiktok.com/@nasa/video/7707774305056083213",
"authorUsername": "nasa",
"durationSec": 146,
"views": 100300,
"language": "en",
"transcriptSource": "native",
"captionKind": "CREATOR",
"transcript": "From turning up the power at Kennedy Space Center to turning our sights toward the Red Planet...",
"wordCount": 377,
"segments": [{"start": 0.42, "end": 2.66, "text": "From turning up the power at Kennedy Space Center"}]
}
transcriptSource (native, ai or none) and captionKind let you filter by quality later. For research on hooks, the first two or three segments are usually what you want.
The hosted version
The actor is TikTok Transcript Scraper on Apify. It does everything above: captions first with the claInfo logic, Whisper only when there is no caption, music detection, SRT and WebVTT output, and video stats on every row.
Pricing: $1.50 per 1,000 transcripts from TikTok captions, $0.004 per started minute for AI transcripts, $0.50 per 1,000 rows with stats but no transcript, and errors (deleted, private, invalid) are free. A typical mix comes out around $2 per 1,000 videos. One honest limit: AI transcription only runs on paid Apify plans, because it costs real money per minute. On the free plan you get TikTok captions only.
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("zrk1212/tiktok-transcript-scraper").call(run_input={
"profiles": ["nasa"],
"maxVideosPerProfile": 20,
"aiFallback": True,
"skipVideosWithoutTranscript": True,
})
for row in client.dataset(run["defaultDatasetId"]).iterate_items():
if row.get("error"):
continue
print(row["transcriptSource"], row["wordCount"], row["transcript"][:80])
It does not search TikTok by hashtag or keyword itself yet. Run a hashtag scraper first and pass its dataset ID in datasetId.
A last note on use: transcripts are the creators' words. Research, analysis and accessibility are the common uses. Check copyright before republishing them.
Top comments (0)