Skip to Content

Post Transcript

A video's captions as text.

GET
/v1/youtube/post/transcript

Authorization

apiKey
headerAuthorizationBearer <token>

An API key from the dashboard: Authorization: Bearer sapi_….

Query Parameters

url?string

The video's link.

id?string

The video's id, instead of url.

language?string

A language code (en, de, pt-BR): its captions when the video has them, else those in the language spoken.

maxAge?integer

How old a cached answer may be, in seconds; 0 always fetches. Default and most: the endpoint's cache lifetime.

Formatint64
Range0 <= value

Response Body

The answer.

application/json
  1. response

One item, as every single-item endpoint answers: { "data": … }.

data*

A video's captions as text.

Example Request
import { SocialAPI } from "@socialapihq/sdk";const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });const { data } = await client.youtube.postTranscript({ url: "https://www.youtube.com/watch?v=Ip5EiqbuBpE", language: "en" });
Example Response
{  "data": {    "postId": "Ip5EiqbuBpE",    "language": "en",    "generated": true,    "languages": [      "en"    ],    "text": "Did you know that you can play any game,\neven PC games, on Mac for free?\nWell, okay, not any game. And you still\nhave to buy the software,\nnot to mention a Mac. But thanks to a\nnew open source program called FX Steam\nLauncher, you can now run Steam OS on\nApple Silicon, unlocking buckets of\ngames that were previously impossible to\nrun, either due to macOS not supporting\n32-bit apps anymore or devel…",    "cues": [      {        "startSeconds": 0,        "endSeconds": 7.1,        "text": "Did you know that you can play any game,"      },      {        "startSeconds": 1.8,        "endSeconds": 7.1,        "text": "even PC games, on Mac for free?"      },      {        "startSeconds": 7.8,        "endSeconds": 12.5,        "text": "Well, okay, not any game. And you still"      }    ]  }}