Get a YouTube video thumbnail from the YouTube API

Getting a Youtube video thumbnail is very easy thanks to YouTube for their predictable format.

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 is a full-size image and rest of them are thumbnails(ie.1,2,3)

The default thumbnail would be, that you see when the video previews.

http://img.youtube.com/vi/[youtube-video-id]/default.jpg

For the high-quality version of the thumbnail use an url similar to this:

http://img.youtube.com/vi/[youtube-video-id]/hqdefault.jpg

There is also a medium quality version of the thumbnail, using an url similar to the HQ:

[cod]http://img.youtube.com/vi/[youtube-video-id]/hqdefault.jpg[/code]

For the standard definition version of the thumbnail,

http://img.youtube.com/vi/[youtube-video-id]/sddefault.jpg

For the maximum resolution version of the thumbnail use a similar to this:

http://img.youtube.com/vi/[youtube-video-id]/maxresdefault.jpg

You can use https as well with these urls.

In a programming language you can use YouTube data API to pull the thumbnails in effective

 

Editorial Staff
 

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.