youtubegdata

YouTube captions example


Can anyone provide an example of how to retrieve captions for YouTube video?

Based on API docs, API request https://gdata.youtube.com/feeds/api/videos?q=surfing&caption&v=2

returns list of videos about surfing with captions.

However a request for the first video from the list

https://gdata.youtube.com/feeds/api/videos/bQX4fustG9Q?v=2&key=DEVELOPERKEY

returns feed that shows no traces of captions.

What am I missing?

Can someone please post an example of request that will retrieve captions for that video?


Solution

  • According to the docs, you don't need to send any special parameters in the initial request, but instead retrieve videos normally and then look for the link with rel=http://gdata.youtube.com/schemas/2007#video.captionTracks.

    Note that the caption link is only visible to the owner of a video.