SO fiddle

Test Fiddle mainly for SO Questions

by Nick Craver

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/overcast/jquery-ui.css">

JavaScript

function fetchPlaylist(pid, start, items) {
    items = items || [];
    start = start || 0;
    var the_url = 'http://gdata.youtube.com/feeds/api/playlists/' + encodeURIComponent(pid) + '?v=2&alt=jsonc&max-results=50';
    $.ajax({
        type: "GET",
        url: the_url,
        data: { start: start },
        dataType: "jsonp",
        success: function(responseData, textStatus, XMLHttpRequest) {
            if (responseData.data != null) {
                if (responseData.data.items) {
                    $.merge(items, responseData.data.items); //add to items
                    if (responseData.data.totalItems > start + 50) {
                        fetchPlaylist(pid, start + 50, items);
                    } else {
                        outputFunction(items);
                    }
                } else {
                    console.log('No results for playlist: "' + pid + '"');
                }
            }
        }
    });
}

function outputFunction(items) {
    console.log(items);
}
fetchPlaylist("84780DAC99E1A285");