Search code examples
videoyoutubeyoutube-api

If I want to get the thumbnail URL for a YouTube video, should I be using the "videos" API or the "thumbnails" API?


The YouTube API has a page for thumbnails and a page for videos. If I want the thumbnails for a certain YouTube video, which API should I be using?

I'm inclined to say the thumbnail API, but I can't figure out how to get information out of it? Can I only set with it? The first bullet point on the thumbnail API docs seems to indicate that I can get images from it:

A resource's snippet.thumbnails property is an object that identifies the thumbnail images available for that resource.


Solution

  • The only method available on thumbnails ressource is set means :

    Uploads a custom video thumbnail to YouTube and sets it for a video.

    https://developers.google.com/youtube/v3/docs/thumbnails

    So you can't retrieve a thumbnail of a video with the resource thumbnails. You need to use the ressource videos.list https://developers.google.com/youtube/v3/docs/videos/list with paramter snippet and specific videoId