ScrapeMole
Home / Tools / YouTube transcript

YouTube transcript API

Use when you need what is said in a YouTube video: full transcript text plus timestamped segments, in the requested language (manual captions preferred, auto-generated as fallback, optional translation). $0.005 per successful call; videos without captions and errors are not charged.

Call it →openapi.jsonLive on Base$0.005 USDC per successful call

Parameters

GET https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/transcript

NameRequiredDescription
videoyesYouTube video URL or 11-character video ID.
langnoPreferred language code(s), comma-separated, in order of preference.
Default: en
translatenoTranslate the transcript into this language code if the video lacks it.
segmentsnoInclude timestamped segments.
One of: true false
Default: true

Call it

// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig, decodePaymentResponseHeader } from '@x402/fetch';
import { ExactEvmScheme } from '@x402/evm';
import { privateKeyToAccount } from 'viem/accounts';

// Your agent's own wallet, holding a little USDC on Base. No ScrapeMole account or API key.
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(account) }],
});

// On 402 the wrapper signs the USDC authorization and retries once.
const res = await pay('https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/transcript?video=aircAruvnKk&segments=false');
console.log(res.status, await res.json());
// Settled only on 200; the receipt (tx hash) is in the PAYMENT-RESPONSE header.
if (res.ok) console.log(decodePaymentResponseHeader(res.headers.get('payment-response')));

Also available as the MCP tool youtube_transcript on https://scrapemole-api-mainnet.scrapemole.workers.dev/mcp (x402 MCP transport, same price).

Example response

A real response from this endpoint (arrays and long strings trimmed here).

{
  "videoId": "aircAruvnKk",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "channelName": "3Blue1Brown",
  "channelId": "UCYO_jab_esuFRV4b17AJtAw",
  "channelUrl": "https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw",
  "durationSeconds": 1120,
  "viewCount": 24708996,
  "description": "What are the neurons, why are there layers, and what is the math underlying it?\nHelp fund future projects: https://www.patreon.com/3blue1…",
  "keywords": [],
  "thumbnailUrl": "https://i.ytimg.com/vi/aircAruvnKk/sddefault.jpg",
  "isLive": false,
  "publishDate": "2017-10-05",
  "publishDateText": "Oct 5, 2017",
  "language": "en",
  "languageName": "English",
  "isAutoGenerated": false,
  "isTranslated": false,
  "availableLanguages": [
    {
      "languageCode": "ar",
      "languageName": "Arabic",
      "isAutoGenerated": false
    },
    {
      "languageCode": "bn",
      "languageName": "Bangla",
      "isAutoGenerated": false
    },
    "… 1 more"
  ],
  "transcriptText": "This is a 3. It's sloppily written and rendered at an extremely low resolution of 28x28 pixels, but your brain has no trouble recognizing…",
  "segments": [
    {
      "start": 4.22,
      "duration": 1.18,
      "end": 5.4,
      "text": "This is a 3."
    },
    {
      "start": 6.06,
      "duration": 4.653,
      "end": 10.713,
      "text": "It's sloppily written and rendered at an extremely low resolution of 28x28 pixels,"
    },
    "… 1 more"
  ],
  "srt": "1\n00:00:04,220 --> 00:00:05,400\nThis is a 3.\n\n2\n00:00:06,060 --> 00:00:10,713\nIt's sloppily written and rendered at an extremely low reso…",
  "segmentCount": 286,
  "wordCount": 3357,
  "characterCount": 18430,
  "transcriptSource": "IOS"
}

Live test results

10/10Live calls from Cloudflare Workers (with regional retry), 11 Oct 2026 11:15 UTC

Paid end-to-end checks (Base Sepolia testnet, 11 Oct 2026 18:36 UTC)

CallStatusChargedPass
unpaid /v1/youtube/transcript402price quoted✓
paid /v1/youtube/transcript?video=aircAruvnKk&segments=false200$0.005✓
paid /v1/youtube/transcript?video=xxxxxxxxxxx (unknown video)404$0✓

Errors

Failures return JSON like {"error": {"code": "NOT_FOUND", "message": "…", "charged": false}}. None of them are charged.

Status / errorCodeMeaning
400 INVALID_INPUTMissing or malformed parameter. Fix the input.
404 NOT_FOUNDThe video, channel, product or term doesn't exist or isn't public.
404 NO_DATAIt exists, but has nothing to return (for example no captions).
503 BLOCKEDThe source rate-limited us even after retries. Try again later.
502 / 504Upstream error or timeout. Try again.
402No or invalid payment. Pay the quoted amount and retry.