I'm trying to insert captions for a Youtube video using the Youtube API v3. Please note that I am not using any client library for this, only pure Node.js code.
When I make a request to this endpoint:
HTTP Method: POST
URL: https://youtube.googleapis.com/youtube/v3/captions?part=id,snippet
Content-Type: "application/json"
Request Body:
{
"snippet": {
"language": "en",
"name": "Test",
"videoId": "r6RMj7Y-NwL"
}
}
I get this error The request does not contain the caption track contents. and that's clear because I have not uploaded any file, but how to upload it, it's not said how to do that in the Youtube API documentation https://developers.google.com/youtube/v3/docs/captions/insert
How the request should looks like to insert captions to Youtube video. Please help me. It would be great if you could show how to do that using Node.js/Curl/Java/PHP without using client library