7

Is it possible to add subtitles to Youtube video using Google Youtube API v3 (important condition - for video's not owner)?

Task: add custom subtitles in selected language using the Google APIs Client Library for JavaScript.

(Google maps API allows add, custom Markers (for example) to their maps, maybe there is a solution for subtitles when we're talking about Youtube API?)

Alexander
  • 71
  • 1
  • 3

1 Answers1

3

Google are calling them "captions" and API section is called YouTube API v2.0 – Captions.

Please note the following requirements for executing caption-related API operations:

  • Captions are only available for API version 2.
  • Captions for a video can only be created, retrieved, modified and deleted by the owner of that video. To perform these operations for a video, you must submit authenticated API requests for which the video's owner is the logged-in user. Accordingly, API requests for caption operations must contain a properly formatted Authorization header.
  • Requests to create (POST), update (PUT) or delete (DELETE) captions must identify your developer key using either the X-GData-Key request header or the key request parameter.

That means, that you can add captions with API, but you need to have owner access to that video. It is strict policy, so that you won't show "wrong" captions on any video, for example, that show different translation of content in video, than there actually is.

You can only hack around this, by putting video inside container, and overlay your own text over video thus simulating captions.

Deele
  • 3,728
  • 2
  • 33
  • 51