YouTube API endpoint
Returns the caption cues for a YouTube video by its 11-character video id, in the language given by `lang` (ISO 639-1, default `en`). Each cue has its text, start time and duration. Works for both auto-generated and human-written captions.
/youtube/captions/{id}Path parameters:
id: required. YouTube video ID (11-character code).Query parameters:
lang: optional. Caption language code (ISO 639-1), defaults to en. Default: en.| Field | Filled in, of 520 checked | Values in the sample |
|---|---|---|
| text | 500 | |
| start | 500 | 0.4 to 2,346.39, median 1,076.77 |
| duration | 500 | 0.08 to 30.45, median 3.12 |
| Parameter | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
| id (path) | string | Yes | YouTube video ID (11-character code) | YbJOTdZBX1g | |
| lang | string | No | **en** | Caption language code (ISO 639-1), defaults to **en** | |
| x-api-key (header) | string | Yes | API key required |
curl -X GET "https://api.crawlora.net/api/v1/youtube/captions/YbJOTdZBX1g?lang=en" \ -H "x-api-key: $CRAWLORA_API_KEY"
{
"code": 200,
"msg": "OK",
"data": [
{
"text": "Andrew Mayne: Welcome to the OpenAI podcast.",
"start": 0.399,
"duration": 1.921
}
]
}Request schema
No body schema
Response schema
#/definitions/youtube.captionsResponseDoc
| Field | Type | Required | Enum | Bounds | Example | Description |
|---|---|---|---|---|---|---|
| code | integer | No | 200 | |||
| data | array | No | ||||
| data[].duration | number | No | Length of the caption cue, in seconds. | |||
| data[].start | number | No | Time the caption cue starts, in seconds from the start of the video. | |||
| data[].text | string | No | Caption text shown for this cue. | |||
| msg | string | No | OK |
| Status | Description | Schema |
|---|---|---|
| 400 | Missing or invalid parameters | #/definitions/app.Response |
| 429 | Rate limit exceeded | #/definitions/app.Response |
| 500 | Internal server error | #/definitions/app.Response |
Use environment variables for secrets and keep Crawlora API keys server-side.
curl -X GET "https://api.crawlora.net/api/v1/youtube/captions/YbJOTdZBX1g?lang=en" \
-H "x-api-key: $CRAWLORA_API_KEY"