Skip to content

Instantly share code, notes, and snippets.

@pope
Created November 21, 2010 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pope/709091 to your computer and use it in GitHub Desktop.
Save pope/709091 to your computer and use it in GitHub Desktop.
function processListOfVideos(obj) {
// My assumption is that $('#listOfVideos') resolves to an unordered list so that I can put things into it
var ul = $('#listOfVideos');
$.each(obj.entry, function() {
var mediaUrl = this['media$group']['media$player'][0].url;
$('<li/>', { html: mediaUrl }).appendTo(ul);
});
// If there are any more videos, load them too
$.each(obj.link, function() {
if (this.rel === 'next') {
$.getJSON(this.rel + '&callback=?', processListOfVideos);
}
});
}
$.getJSON("http://gdata.youtube.com/feeds/api/users/Deckswax/uploads?alt=json&callback=?", processListOfVideos);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment