Get YouTube video thumbnails URL with jQuery


/ Published in: jQuery
Save to your folder(s)

Lets you get YouTube video scene images by video id or youtube video url using only javascript OR jQuery.


Copy this code and paste it in your HTML
  1. function getScreen( url, size )
  2. {
  3. if(url === null){ return ""; }
  4.  
  5. size = (size === null) ? "big" : size;
  6. var vid;
  7. var results;
  8.  
  9. results = url.match("[\\?&]v=([^&#]*)");
  10.  
  11. vid = ( results === null ) ? url : results[1];
  12.  
  13. if(size == "small"){
  14. return "http://img.youtube.com/vi/"+vid+"/2.jpg";
  15. }else {
  16. return "http://img.youtube.com/vi/"+vid+"/0.jpg";
  17. }
  18. }

URL: http://jquery-howto.blogspot.com/2009/02/how-to-get-youtube-video-screenshot.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.