I've got an html page that currently displays the videos of a playlist but it's only returning the first 25 videos:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery.youtubepopup.js"></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function () {
var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/A6A0F817C1771FE5?v=2&alt=json&callback=?';
var videoURL = 'http://www.youtube.com/watch?v=';
$.getJSON(playListURL, function (data) {
var list_data = "";
var column_count = -1;
var begin_table = "<table width='100%'><tr>";
var end_table = "</table>";
var html_data = "";
$.each(data.feed.entry, function (i, item) {
column_count = column_count + 1;
var feedTitle = item.title.$t;
var feedURL = item.link[1].href;
var fragments = feedURL.split("/");
var videoID = fragments[fragments.length - 2];
var url = videoURL + videoID;
var thumb = "http://img.youtube.com/vi/" + videoID + "/default.jpg";
if(column_count <= 3)
html_data += '<td><a class="youtube" href="#" rel="' + videoID + '" title="' + feedTitle + '"><img alt="' + feedTitle + '" src="' + thumb + '"></a></td>';
else
{
column_count = 0;
html_data += "</tr><tr>";
html_data += '<td><a class="youtube" href="#" rel="' + videoID + '" title="' + feedTitle + '"><img alt="' + feedTitle + '" src="' + thumb + '"></a></td>';
}
});
html_data = begin_table + html_data + end_table;
$(html_data).appendTo(".vidz");
$("a.youtube").YouTubePopup({ autoplay: 1 });
});
});//]]>
</script>
Anyone know how to get the rest of the videos? There's 27 (I believe) in this playlist. I don't have much exprience with json so I'm kinda stuck atm.
Thanks for any help!
You need to define the max-results in your request, only 25 are returned by default.
http://code.google.com/apis/youtube/2.0/reference.html#max-resultssp
The following snippet is returning 28 results: