Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
- http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
- <script type="text/javascript">
- function youtubeFeedCallback(json){
- document.write('<img src="' + json["data"]["thumbnail"]["sqDefault"] + '">');
- }
- </script>
- <script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=youtubeFeedCallback"></script>
- $.getJSON("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=?", function(json){
- $("<img/>").attr("src", json["data"]["thumbnail"]["sqDefault"]).appendTo("body");
- });
- <?php
- $json = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc"));
- echo '<img src="' . $json->data->thumbnail->sqDefault . '">';
- http://i3.ytimg.com/vi/SomeVideoIDHere/0.jpg
- //grab the default thumb
- $attrs = $media->group->thumbnail[1]->attributes();
- $thumbnail = $attrs['url'];
- $thumbnail = substr($thumbnail, 0,-5);
- $thumb1 = $thumbnail."default.jpg";
- //grab the third
- $thumb2 = $thumbnail."2.jpg";
- //grab the fourth.
- $thumb3 = $thumbnail."3.jpg";
- //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.
- $ch = curl_init ("$thumb1");
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
- $rawdata=curl_exec ($ch);
- curl_close ($ch);
- //using fwrite to save the above
- $fp = fopen("SomeLocationInreferenceToYourScript/AnyNameYouWant.jpg",'w');
- //write the file
- fwrite($fp, $rawdata);
- //and then close it.
- fclose($fp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement