YouTube transcript API: how to fetch a video transcript by URL
Get a YouTube video's transcript and language, plus timed segments when available, from a URL or ID
On this page
You have 25 YouTube video URLs from a competitor channel and need each video's transcript and language to compare messaging. The deliverable is a table with one row per video and the transcript fields needed for that comparison
Nothing has been run for this guide. The table below is a design, and its values are placeholders showing the shape
The task and worksheet design
Start with the 25 URLs and a workbook. One row per video holds the URL you supply, found, data.language, data.transcript, and the segment fields. The first columns answer whether the call found a transcript and which language it is in. The transcript column feeds topic coding. The segment fields are data.segments.startSeconds, data.segments.durationSeconds and data.segments.text; store them as lists in source order so a timed quote can be matched to the right moment
| Video URL (reader-added) | found | data.language | data.transcript | data.segments.startSeconds | data.segments.durationSeconds | data.segments.text |
|---|---|---|---|---|---|---|
| Example URL | true or false | (language) | (transcript text) | (list of starts) | (list of durations) | (list of segment texts) |
Values here are placeholders showing the shape
Example input and what the tool takes
Example input (invented), to be replaced with one of your own URLs: https://youtu.be/8fJX2kL9QaM
The contract's input schema requires url or id; either one satisfies the anyOf. For this task, supply url
url is a full YouTube video URL. The contract says Shorts (youtube.com/shorts/...), youtu.be, live and embed URLs work. id is the YouTube video ID, and a Short uses the same ID as any other video
Keep the URL column in the deliverable because it is the reader-added key. For a batch, keep the original URL in the first column and do not replace it with the video ID. The ID is an alternate input for calls where you already have it
How to read the output fields
found is the first decision field. When it is false, reason is present and set to not_found; the row stops with no transcript. The contract says a found: false answer is a successful call, not an error, and costUsd is what it actually cost
When found is true, read data.language and data.transcript. Both are populated whenever the provider has data for the entity, according to the contract. The data field can be null; a null data leaves no transcript to read
For timed comparison, read data.segments. Each item has text, startSeconds and durationSeconds. Use found as the stop/go field, data.language as the language label for the comparison, data.transcript as the plain transcript text for topic coding, and data.segments for timed opening-hook checks. A row with found: false is not an error row; it records a successful call with no transcript. If data.segments is absent, the row can still support topic comparison; the timed hook column stays empty
Segments appear when the serving lane supplies caption timing. A response can carry data.transcript and data.language without timed segments. The tool cannot add caption timing that the serving lane does not supply, so do not plan a quote-level table unless the segment array is present
The agent prompt
Use this prompt with the 25 URLs. It tells the agent to check current inputs and price of the tool id before running and to return a table
Set up https://purrkey.app/SKILL.md, then use Purrkey to fetch YouTube
video transcripts for the URLs below. Check the current inputs and price
of anyapi.youtube.video_transcript before running anything. Call the tool
once per URL. Return a table with video URL, found, data.language,
data.transcript, data.segments.startSeconds,
data.segments.durationSeconds and data.segments.text. If found is false,
leave the language, transcript and segment fields empty and add reason.
Do not guess a transcript. Do not convert a URL to a different video.
https://youtu.be/8fJX2kL9QaMReplace the single example URL with your 25 URLs before the run
Estimated tool cost
The Purrkey catalog lists anyapi.youtube.video_transcript called through POST /v1/runs with toolId anyapi.youtube.video_transcript, unit max_call, up to $0.011 per call, read November 13, 2026. The unit max_call means: Maximum per call. Successful runs settle at the actual AnyAPI charge. The totals below are ceilings, not settled charges. Model fees for the agent are not counted
| Step | Formula | Unit price | Planned quantity | Total |
|---|---|---|---|---|
| One video transcript | calls x max price | $0.011 per call | 1 call | $0.011 |
| Ten video transcripts | calls x max price | $0.011 per call | 10 calls | $0.11 |
The 25-URL job is 25 calls at most $0.275 at the same unit price
Fetch the transcripts for the channel
Open the tool page to start the first video or to copy the tool id into the prompt: YouTube transcript tool
Get started by giving this to your agent
- Claude Code
- Codex
- Gemini CLI
- Cursor
- GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with YouTube.FAQ
How do I get a YouTube video transcript by URL?
Call anyapi.youtube.video_transcript with url set to the YouTube video URL. The response includes found, data.language and data.transcript, plus data.segments when caption timing is supplied.
Can I use a YouTube Short ID with anyapi.youtube.video_transcript?
Yes. The id field accepts a YouTube video ID, and a Short uses the same ID as any other video.
What does found false mean for a YouTube transcript call?
It means there is no result. The contract says a found: false answer is a successful call, not an error, and reason is not_found.
When does the transcript response include timed segments?
The response includes data.segments when the serving lane supplies caption timing. A response can have data.transcript and data.language without timed segments.
How much does one YouTube transcript call cost?
The catalog lists anyapi.youtube.video_transcript at up to $0.011 per call. The unit is max_call, and successful runs settle at the actual AnyAPI charge.
How much do ten YouTube transcripts cost?
Ten calls at the listed ceiling are $0.11. The total is a ceiling, not a settled charge.
What input formats work for the YouTube transcript tool?
url accepts a full YouTube video URL, including Shorts, youtu.be, live and embed URLs. id accepts a YouTube video ID.
Next step
Try this with YouTube
The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.