Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 19th, 2012  |  syntax: None  |  size: 2.08 KB  |  views: 185  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
  2. http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
  3. http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
  4. http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
  5.        
  6. http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
  7.        
  8. http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
  9.        
  10. http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
  11.        
  12. http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
  13.        
  14. <script type="text/javascript">
  15.     function youtubeFeedCallback(json){
  16.         document.write('<img src="' + json["data"]["thumbnail"]["sqDefault"] + '">');
  17.     }
  18. </script>
  19. <script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=youtubeFeedCallback"></script>
  20.        
  21. $.getJSON("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=?", function(json){
  22.     $("<img/>").attr("src", json["data"]["thumbnail"]["sqDefault"]).appendTo("body");
  23. });
  24.        
  25. <?php
  26. $json = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc"));
  27. echo '<img src="' . $json->data->thumbnail->sqDefault . '">';
  28.        
  29. http://i3.ytimg.com/vi/SomeVideoIDHere/0.jpg
  30.        
  31. //grab the default thumb
  32. $attrs = $media->group->thumbnail[1]->attributes();
  33. $thumbnail = $attrs['url'];
  34.     $thumbnail = substr($thumbnail, 0,-5);
  35.     $thumb1 = $thumbnail."default.jpg";
  36. //grab the third
  37.     $thumb2 = $thumbnail."2.jpg";
  38. //grab the fourth.
  39.     $thumb3 = $thumbnail."3.jpg";
  40.  
  41. //Using simple  cURL to save it your server. You can extends the cURL below if you want it fancy just like the rest of the folks here.
  42. $ch = curl_init ("$thumb1");
  43. curl_setopt($ch, CURLOPT_HEADER, 0);
  44. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  45. curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
  46. $rawdata=curl_exec ($ch);
  47. curl_close ($ch);
  48. //using fwrite to save the above
  49. $fp = fopen("SomeLocationInreferenceToYourScript/AnyNameYouWant.jpg",'w');
  50. //write the file
  51. fwrite($fp, $rawdata);
  52. //and then close it.
  53. fclose($fp);