Get TikTok transcripts in Python
A few lines of requests to turn TikTok links into text. No TikTok account, no browser automation, and it works from a server.
1. Get a key
Sign up with your email on the sign-up form and you get a key with 100 free credits. Keep it in an environment variable:
export TRANSKRIO_API_KEY="tk_live_..."
2. One video
import os
import time
import requests
API = "https://api.transkrio.com/v1"
HEADERS = {"x-api-key": os.environ["TRANSKRIO_API_KEY"]}
def tiktok_transcript(url: str) -> dict:
while True:
r = requests.get(f"{API}/transcript", params={"url": url}, headers=HEADERS, timeout=90)
if r.status_code == 202: # being transcribed from the audio
time.sleep(r.json()["retry_after"])
continue
body = r.json()
if r.status_code != 200:
raise RuntimeError(body.get("error", {}).get("message") or body.get("detail"))
return body
t = tiktok_transcript("https://www.tiktok.com/@user/video/7300000000000000000")
print(t["source"]) # "captions" or "speech_to_text"
print(t["text"])
Short share links (vm.tiktok.com/...) work too. Each segment has text, start and duration in seconds.
3. Many videos at once
/v1/batch takes up to 50 URLs. Each one costs what a single call would, and failures are free:
def tiktok_batch(urls: list[str]) -> list[dict]:
out = []
for i in range(0, len(urls), 50):
r = requests.post(f"{API}/batch", headers=HEADERS, timeout=300,
json={"urls": urls[i:i + 50], "format": "text"})
results = r.json()["results"]
out += [x for x in results if x["ok"]]
# items still being transcribed come back with error code "processing": send them again later
return out
4. Subtitles
Ask for format=srt or vtt to get a subtitle file you can edit and re-upload:
srt = requests.get(f"{API}/transcript", headers=HEADERS, timeout=90,
params={"url": "https://vm.tiktok.com/XXXXXXX/", "format": "srt"}).text
What people use it for
Hook and trend research across a niche, turning a creator's videos into posts (content repurposing), and checking what is said in sponsored videos. More on the TikTok Transcript API page, or try one video in the free TikTok transcript generator.