Home / How To / Video transcripts

How to

How to use a video transcript API in Python

Four platforms, four different ways captions break. One API call handles all of them.

Short answer

Send a mixed list of TikTok, Instagram, YouTube and X URLs to the Video Transcript Scraper with the Apify Python client. Each result says which platform it came from and whether the text came from subtitles or speech-to-text.

A real use case

A research team collects videos about a product recall from four platforms. One script transcribes all 300 links and writes them to a CSV for coding.

Step by step

  1. Install apify-client.
  2. Call the actor with your URLs.
  3. Iterate the dataset for results.

Input (paste into the JSON tab)

{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.tiktok.com/@tiktok/video/7106594312292453675"
  ],
  "speechToText": "fallback"
}

Call it from code

# pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("your-apify-token")
run = client.actor("scrape-lads/video-transcript-scraper").call(run_input={
    "urls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw",
        "https://www.tiktok.com/@tiktok/video/7106594312292453675",
    ],
    "speechToText": "fallback",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["platform"], item["status"], item.get("wordCount"))

What you get back

[
  {
    "platform": "youtube",
    "status": "ok",
    "transcriptSource": "subtitles",
    "wordCount": 47
  },
  {
    "platform": "tiktok",
    "status": "ok",
    "transcriptSource": "speech-to-text",
    "wordCount": 132
  }
]

Trimmed example. Names and numbers are illustrative; your run returns real data with more fields.

Tips

  • Rows that failed (private, deleted, no speech) come back with a status and errorCode and are not charged.
  • Getting blocked with youtube-transcript-api? See why it happens.

What it costs

$2 per 1,000 transcripts across all platforms.

Plus a small per-run start fee. Apify's free plan includes monthly credit, enough to test. Check the listing for current pricing.

FAQ

Does it work from a server or Lambda?

Yes. The scraping runs on Apify, so your server's IP is never blocked.

Related

Try it on your own data

Paste the input above, run it, and see your results in a couple of minutes.

Open Video Transcript Scraper