You are here: / Articles / Guides / Technology / Getting the YouTube Video Thumbnail From the API

Getting the YouTube Video Thumbnail From the API

YouTube Video Thumbnail

Share!



The good news is that you do not need to rip the hair off your head to craft a YouTube video thumbnail. This is technology, and with it always comes an easy way to do things you want in a more timely and efficient manner.

The challenge here with most new YouTubers is that after creating their first video, they have to jump into a graphics editor to make a thumbnail to go along with the video.

In some circumstances, this may be ideal as you may want to have a specific theme of visual on your thumbnail when linking to a YouTube video. If that is not you, then there is a quick and easy solution to the problem.

YouTube provides an API that allows you to access the thumbnails that are automatically generated or uploaded when the video was published.

The thumbnails come in varied qualities, namely high quality, medium quality, standard definition, and max quality. These are in addition to the four images that are generated by default.

The four thumbnails can be accessed as follows, with the first being a full-size image while the other three are thumbnails:

Read Also  Data URIs And How to Use Them in Your Web Design Project

https://img.youtube.com/vi/<youtube-video-id>/0.jpg
https://img.youtube.com/vi/<youtube-video-id>/1.jpg
https://img.youtube.com/vi/<youtube-video-id>/2.jpg
https://img.youtube.com/vi/<youtube-video-id>/3.jpg

You can also access the default image using this format URL.
https://img.youtube.com/vi/<youtube-video-id>/default.jpg

For the high-quality version of the thumbnail use an URL with the following format:
https://img.youtube.com/vi/<youtube-video-id>/hqdefault.jpg

This is how to use the medium quality version of the thumbnail:
https://img.youtube.com/vi/<youtube-video-id>/mqdefault.jpg

For the standard definition version of the thumbnail, you can use the following format for your URL:
https://img.youtube.com/vi/<youtube-video-id>/sddefault.jpg

Finally, the maximum resolution version of the thumbnail uses an URL similar to this:
https://img.youtube.com/vi/<youtube-video-id>/maxresdefault.jpg

There you have it. You now have full access to the range of thumbnails available from the public YouTube video thumbnail API.