Extract Thumbnail Images from a YoutTube Video

Thursday, June 02, 2011

As you may know, YouTube uses a server image to store thumb images for the videos. This server is hosted under domain i.ytimg.com.

Using i.ytimg.com server you can extract thumbnail files of any YouTube videos as an image URL. The only thing you need to have is the URL of the video. For example, FIFA 12 First Video can be found here on YouTube: http://www.youtube.com/watch?v=zAHXwCWXGEo and I want to extract its thumbs to use it on my homepage.

In the URL above, you can see the URL parameter which defines zAHXwCWXGEo as for variable "v".  What you need to extract from this URL is the video ID, which is zAHXwCWXGEo.

Now you can use this video ID with i.ytimg.com to get the video thumbs as below:
http://i.ytimg.com/vi/zAHXwCWXGEo/1.jpg

There are four thumb images for a video, i.ytimg.com options are:
- 0.jpg (Image size: 480 x 360 px)
- 1.jpg (Image size: 120 x 90 px)
- 2.jpg (Image size: 120 x 90 px)
- 3.jpg (Image size: 120 x 90 px)

Examples:
http://i.ytimg.com/vi/zAHXwCWXGEo/0.jpg
http://i.ytimg.com/vi/zAHXwCWXGEo/1.jpg
http://i.ytimg.com/vi/zAHXwCWXGEo/2.jpg
http://i.ytimg.com/vi/zAHXwCWXGEo/3.jpg

0 comments:

Post a Comment