YouTube

YouTube video transcript

A video's transcript: its captions as one text and as timed segments, in the language asked for or the one YouTube's player shows first. With original_audio, only captions in the language it was recorded in. A video without captions answers NOT_FOUND.

GET/v1/youtube/videos/transcript1 credit
x-api-key*stringrequiredheader

Your API key, made in the dashboard.

Parameters

4
video_idstringoptionalquery

A video's id: the 11 characters after watch?v= or /shorts/ in its link. Give video_id or url.

example: rfscVS0vtbw

urlstringoptionalquery

A video's link: watch?v=<id>, youtu.be/<id>, or a /shorts/, /live/, /embed/ or /v/ link, on youtube.com, www., m. or music. Give video_id or url.

max 300 chars

languagestringoptionalquery

Which captions: a language code as the video endpoint's captions give it, such as en or pt-BR. When left out, the captions YouTube's player shows first.

original_audiobooleanoptionalquery

Only captions in the language the video was recorded in: a dubbed video's original audio, else the language of YouTube's automatic captions. Not with language.

default: false

Response fields

20
dataobject

The result: one object, or a list for the endpoints that return several.

data.video_idstring

The video's id.

data.languagestring

The captions' language code, such as "en" or "fr-FR".

data.autobooleanoptional

Whether YouTube made the captions automatically from the speech.

default: false

data.textstring

The whole transcript: every segment's text, joined.

data.segmentsarray

The captions in order, each with its start and end.

data.segments[].startnumber

When the caption starts, in seconds from the video's start.

data.segments[].endnumber

When it ends, in seconds.

data.segments[].textstring

What is said.

pageobjectnullable

Paging, for the endpoints that page; null for the others.

page.next_cursorstringnullable

Send it as the cursor parameter, with the same other parameters, for the next page. Null on the last page.

page.has_morebooleanoptional

Whether another page follows.

default: false

metaobject

About this call.

meta.platformstring

The platform: reddit, threads, tiktok or youtube.

meta.endpointstring

The endpoint's name, such as channel_videos.

meta.paramsobject

The call's parameters, defaults included. Parameters without a value, and the cursor, are left out.

meta.request_idstring

This call's id. Quote it when you report a problem.

meta.api_versionstring

The API version that answered.

meta.fetched_atstring

When the data was fetched from the platform (UTC).

format: date-time

meta.cachedbooleanoptional

Whether it came from our cache; fetched_at says how old it is.

default: false

Code example

curl -X GET 'https://api.socialparse.dev/v1/youtube/videos/transcript?video_id=rfscVS0vtbw' \  -H 'x-api-key: YOUR_API_KEY'

Responses

Successful Response

{  "data": {    "video_id": "string",    "language": "string",    "auto": false,    "text": "string",    "segments": [      {        "start": 0,        "end": 0,        "text": "string"      }    ]  },  "page": {    "next_cursor": "string",    "has_more": false  },  "meta": {    "platform": "string",    "endpoint": "string",    "params": {      "property1": "string",      "property2": "string"    },    "request_id": "string",    "api_version": "string",    "fetched_at": "2019-08-24T14:15:22Z",    "cached": false  }}