This post shows how to send a public YouTube video URL or ID to one Actor and collect its transcript through the Apify API. You get the full transcript text, segmented lines with timestamps, and an optional SRT subtitle export when captions are available.
Transcripts make video searchable or ready to feed into a model. YouTube has them for many public videos. Getting them out programmatically is the annoying part.
Our YouTube Transcript Scraper accepts individual video URLs or IDs, including batches that contain both. It reads public transcript feeds without a YouTube API key or OAuth.
Which transcript fields do you get back?
The Actor returns one flat dataset row per processed video. The documented transcript output includes:
- The full transcript text as one string.
- A segmented transcript array with a start time, duration, and text for each line.
- The requested language track when it exists, with the video’s default track as the fallback.
- Optional SRT subtitle content when
includeSrtis set totrue, plus a status flag when a video has no captions.
The segmented form is useful when you need to jump from a quote back to a point in the video. The full string is easier to search or pass into text processing. SRT is intended for subtitle players and editors, and it is stored as a separate attachment per video.
Auto-generated captions are returned when they are available. Keep the timestamps if a reviewer needs to check a passage against the video.
One video
curl -X POST "https://api.apify.com/v2/acts/parseforge~youtube-transcript-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"startUrls": [{ "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }],
"maxItems": 1
}'
You get the transcript text back with its timings. If you want subtitle-file output instead, set includeSrt to true and the SRT comes along with it. That option creates a separate billed SRT export event for the video.
The synchronous endpoint returns the dataset items directly as JSON. Apify also stores the run dataset, which can be exported as CSV, JSON, Excel, or XML.
Which input options control the run?
The Actor has five inputs. Several have useful form prefills but no declared schema default, so the distinction matters for API calls:
startUrlsaccepts an array of YouTube video URL objects. It has no declared default; the form prefill contains one example watch URL.videoIdsaccepts an array of YouTube video ID strings. It has no declared default, and you may use it alone or alongsidestartUrls.languageaccepts an ISO language code such asen. It has no declared default. Leaving it empty requests the video’s default transcript.maxItemscaps transcripts collected from the supplied inputs. It has no declared default, the form prefill is10, and its accepted range is 1 through 1,000,000.includeSrtdefaults tofalse. Set it totrueonly when you need the subtitle-file output in addition to segmented JSON.
The non-obvious language behavior is fallback. If you set language to a track the video does not provide, the Actor uses the video’s default transcript. Do not assume the requested code was available.
A list of videos
startUrls takes a list, so a batch is the same call with a longer array. If you are working from IDs rather than links, videoIds accepts those directly and saves you building URLs. You can provide URLs and IDs together in one run.
Set maxItems to bound the number of transcripts collected. It stops the Actor after that many dataset results even if the input arrays contain more videos. A channel URL is not accepted by this Actor. Use a YouTube channel scraper first, then pass the individual video URLs or IDs into this one.
For recurring batches, save the input as an Apify task and add a schedule.
Languages
language picks the preferred transcript track. Leave it empty and you get the video’s default. Set it to an ISO code and you get that track when the video has it; otherwise, the Actor falls back to the default track.
That fallback prevents a missing translation from automatically discarding an otherwise usable transcript. It also means a multilingual pipeline should inspect what came back before filing the text under a language-specific index.
The Actor retrieves manually uploaded and auto-generated captions. A video with no captions returns an empty transcript with a status flag. Private, age-restricted, region-locked, or embedding-restricted videos may not return a transcript even when a public watch page appears in some contexts.
How much does it cost?
Transcript result rows start at $10.00 per 1,000 results, based on pricing.perResultUsd of $0.01. SRT export is an opt-in, separately billed event that currently starts at $0.003 per video. Apify’s free monthly credit covers a trial, so leave includeSrt off and begin with one public video whose captions you can verify.
The result charge is per transcript row written to the default dataset. Turning on SRT adds the separate SRT charge because the Actor creates the subtitle attachment in addition to the JSON transcript.
What breaks and what we do about it
No result or an empty transcript first calls for checking the URL or ID. Confirm that the video is publicly accessible. Some videos have no captions, in which case the Actor returns an empty transcript; try a known captioned video to separate an input issue from missing source data.
The wrong language usually means the requested track was unavailable. Set language to the desired ISO code, then inspect the result. Leave it empty when the video’s default transcript is acceptable.
A missing SRT file means includeSrt was not set to true. JSON-only runs do not produce the SRT attachment.
A run that stops before the end of the input list has probably reached maxItems. Raise that cap to cover the number of supplied URLs and IDs, while staying within the documented range.
Region locks and captions disabled for embedding can cause an error for a video that appears to have captions on YouTube. Check the video’s access from the run context or try another public video. The Actor cannot retrieve a transcript that YouTube does not expose through its public transcript feed.
FAQ
Does this work for auto-generated captions?
Yes. The Actor retrieves manually uploaded and auto-generated transcripts when available. A video with no captions returns an empty transcript with a status flag.
What is the difference between the JSON transcript and the SRT export?
JSON contains transcript segments with start time, duration, and text, as well as the full transcript string. SRT is a standard subtitle file stored separately for direct use in players and editors, and its export has an additional per-video charge.
Can I input a YouTube channel URL?
No. This Actor accepts individual video URLs or video IDs. Collect a channel’s video URLs with a channel scraper, then pass those URLs into startUrls.
Do I need a YouTube API key?
No. The Actor reads public transcript feeds directly without a YouTube API key or OAuth. It does not consume YouTube API quota.
Open the Apify listing, run one known captioned video with includeSrt left at false, and inspect the language and timestamped segments.