Each YouTube video is associated with four images, listed 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 is a full size image and others are thumbnail images.
Eg: for the video http://www.youtube.com/watch?v=JW5meKfy3fY
Here the youtube-video-id is 'JW5meKfy3fY', to get the thumbnails we can use the following urls:
YouTube video thumbnail generation using JavaScript
function getThumbnail( yUrl, imageSize ){
if( yUrl === null ){
return "";
}
imageSize = (imageSize === null) ? 0 : imageSize;
var vId;
var results;
//getting video id using regular expression
results = yUrl.match("[\\?&]v=([^&#]*)");
vId = results[1];
if(imageSize == 0 ){
// small image
return "http://img.youtube.com/vi/"+vId+"/2.jpg";
}else {
// large image
return "http://img.youtube.com/vi/"+vId+"/0.jpg";
}
}
Note: This post is for my reference only.
wow thanks, that was great. would love to see others like this.
ReplyDeleteBe a dynamic YouTuber. Similarly as with all web-based social networking stages keeping in mind the end goal to get comes about it is imperative to remain predictable. Build up sensible and reasonable interims at which you will transfer new substance.tubemate
ReplyDeleteYou can easily enjoy numerous companies with using the internet. You can easily sell as well as promote your items by utilizing the net. A really helpful on-line tool that you can take advantage of for any sort of business is YouTube.
ReplyDeletewhere to get youtube subs