View Single Post
Old 10-10-2012, 04:58 PM   PM User | #4
erebus
New Coder

 
Join Date: Sep 2012
Location: Houston, TX
Posts: 22
Thanks: 2
Thanked 0 Times in 0 Posts
erebus is an unknown quantity at this point
Quote:
Originally Posted by xelawho View Post
you can plug that url in here which makes it a bit more humanly readable
That is bookmarked and a great new reference, thank you very very much for that... my god just a few moments looking at that format and i had it all figured out,

Wrote the callback and function and i was dead on using the link you gave me!

If your interested at all or anyone out there would like some youtue API reference material here is the results

Callback:

Code:
<script 
    type="text/javascript" 
    src="https://gdata.youtube.com/feeds/api/videos?q=dayz&category=gaming&orderby=viewCount&max-results=3&v=2&alt=json-in-script&callback=showMyVideos">
</script>
Function:

Code:
function showMyVideos(data)
{
   var feed = data.feed;
   var base = feed.entry;
   for (var i = 0; i < base.length; i ++ )
   {
      document.getElementById("videologo" + (i + 1)).src = base[i].media$group.media$thumbnail[0].url;
      document.getElementById("videoname" + (i + 1)).innerHTML = base[i].title.$t;
      var status = base[i].media$group.media$description.$t;
      if (status.length > 76)
      {
      var statusubstr = status.substr(0,76)
      document.getElementById("videoinfo" + (i + 1)).innerHTML = "<p>" + statusubstr + "... </p>";
      }
      else
      {
      document.getElementById("videoinfo" + (i + 1)).innerHTML = "<p>" + status + " </p>";
      }
   }
}
erebus is offline   Reply With Quote