Suppose I want to find list of videos which have the phrase "French presidential election" in its subtitle.
Can I do this using YouTube API?
It will be perfect if it can even search within both human-generated and auto-generated subtitles. But it will be good enough if it can search either of the two types of subtitles.
You may refer with this documentation. You can use Captions: list
which returns a list of caption tracks that are associated with a specified video.
Note that the API response does not contain the actual captions and that the captions.download
method provides the ability to retrieve a caption track.
You need to provide the videoId
parameter that specifies the YouTube video ID of the video for which the API should return caption tracks.
Here's a related thread: How to add Subtitles to Youtube video using Youtube API?