How To Get YouTube Thumbnail Images

youtubeThere are a few different ways that you can get thumbnails from a YouTube video, one of which is to use YouTube’s Video API to extract the thumbnail. YouTube API responses may contain multiple thumbnail images for a video, each of which is identified by a <media:thumbnail> tag. Creating a call to YouTube to get the video and thumbnail information can take some time and when you are like me and don’t know a think about writing code, then the API is relatively useless. For me, I needed a simple way to pull down a thumbnail and thankfully, there is a simple way to do this.

Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<youtube-video-id>/0.jpg
http://img.youtube.com/vi/<youtube-video-id>/1.jpg
http://img.youtube.com/vi/<youtube-video-id>/2.jpg
http://img.youtube.com/vi/<youtube-video-id>/3.jpg

The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<youtube-video-id>/default.jpg

For the high quality version of the thumbnail use a url similar to this:
http://img.youtube.com/vi//hqdefault.jpg

There is also a medium quality version of the thumbnail, using a url similar to the HQ:
http://img.youtube.com/vi/<youtube-video-id>/mqdefault.jpg

For the standard definition version of the thumbnail, use a url similar to this:
http://img.youtube.com/vi/<youtube-video-id>/sddefault.jpg

For the maximum resolution version of the thumbnail use a url similar to this:
http://img.youtube.com/vi/<youtube-video-id>/maxresdefault.jpg

All of the above urls are available over https too. Just change http to https in any of the above urls. Additionally, the slightly shorter hostname i3.ytimg.com works in place of img.youtube.com in the example urls above.

You may also like...