This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

code

By: a guest on Sep 6th, 2012  |  syntax: HTML  |  size: 1.75 KB  |  views: 35  |  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. <html>
  2. <head>
  3. <?php
  4. $id = $_GET['id'];
  5. $string = "http://gdata.youtube.com/feeds/api/videos/" . $id ."?v=2&amp;alt=json-in-script&amp;callback=youtubeFeedCallback";
  6. ?>
  7.  
  8.  
  9. <title></title>
  10. </head>
  11. <body>
  12. <?php echo $string; ?>
  13. <script type="text/javascript" src="<?php echo $string; ?>"></script>
  14.  
  15. <script type="text/javascript">
  16.   function youtubeFeedCallback(data) {
  17.     var s = '';
  18.          alert(id);
  19.     s += '<img src="' + data.entry.media$group.media$thumbnail[0].url + '" width="' + data.entry.media$group.media$thumbnail[0].width + '" height="' + data.entry.media$group.media$thumbnail[0].height + '" alt="' + data.entry.media$group.media$thumbnail[0].yt$name + '" align="right"/>';
  20.     s += '<b>Title:</b> ' + data.entry.title.$t + '<br/>';
  21.     s += '<b>Author:</b> ' + data.entry.author[0].name.$t + '<br/>';
  22.     s += '<b>Published:</b> ' + new Date(data.entry.published.$t).toLocaleDateString() + '<br/>';
  23.     s += '<b>Duration:</b> ' + Math.floor(data.entry.media$group.yt$duration.seconds / 60) + ':' + (data.entry.media$group.yt$duration.seconds % 60) + ' (' + data.entry.media$group.yt$duration.seconds + ' seconds)<br/>';
  24.     if (data.entry.gd$rating) {
  25.       s += '<b>Rating:</b> ' + data.entry.gd$rating.average.toFixed(1) + ' out of ' + data.entry.gd$rating.max + ' (' + data.entry.gd$rating.numRaters + ' ratings)<br/>';
  26.     }
  27.     s += '<b>Statistics:</b> ' + data.entry.yt$statistics.favoriteCount + ' favorite(s); ' + data.entry.yt$statistics.viewCount + ' view(s)<br/>';
  28.     s += '<br/>' + data.entry.media$group.media$description.$t.replace(/\n/g, '<br/>') + '<br/>';
  29.     s += '<br/><a href="' + data.entry.media$group.media$player.url + '" target="_blank">Watch on YouTube</a>';
  30.     document.write(s);
  31.   }
  32. </script>
  33.  
  34.  
  35.  
  36. </div>
  37. </body>
clone this paste RAW Paste Data