Youtube video thumbnails

youtube

If you want to display thumbnail images from a youtube video it is possible to link to them directly, as they are accessible using a predictable address.

To be able to show images from youtube videos, all you need is to locate the ID for the video You can find this from an youtube url :

In this example the videoID is NQowXJ-C4nY

Each YouTube video has images. They are formatted as:

The image locations are available as both http and https, and i3.ytimg.com can be used instead of img.youtube.com 

https://img.youtube.com/vi/NQowXJ-C4nY/0.jpg
https://img.youtube.com/vi/NQowXJ-C4nY/1.jpg
https://img.youtube.com/vi/NQowXJ-C4nY/2.jpg
https://img.youtube.com/vi/NQowXJ-C4nY/3.jpg

The default thumbnail image is 120px x 90 px

https://img.youtube.com/vi/NQowXJ-C4nY/default.jpg

The default thumbnail is available in default, medium and standard quality versions, using either: 

https://img.youtube.com/vi/NQowXJ-C4nY/hqdefault.jpg
https://img.youtube.com/vi/NQowXJ-C4nY/mqdefault.jpg
https://img.youtube.com/vi/NQowXJ-C4nY/sddefault.jpg

To get the default image in max resolution use: maxresdefault.jpg :

 

https://img.youtube.com/vi/NQowXJ-C4nY/maxresdefault.jpg

 

Api

If you want to do more with YouTube, such as upload video, manage playlists, set new thumbnail images, etc. you can use YouTube’s API to do so. Their example page has code snippets available for Go, Java, JavaScript, .NET, PHP, Python, etc.

Using the api it is possible to:

  • Handle captions
  • Handle channels
  • Manage comments
  • Manage live streaming.
  • Handle playlists
  • Search YouTube for content.
  • Handle video thumbnails
  • Upload delete or add watermarks to videos

A portion of the API does not require authentication, - it is possible to play with a subset of the possibilities here