So, here's my code for getting a youtube user's public playlists:
function getyoutubeplaylists($userName) {
$yt = connectyoutube();
$yt->setMajorProtocolVersion(2);
$playlistListFeed = $yt->getPlaylistListFeed($userName);
foreach ($playlistListFeed as $playlistListEntry) {
$playlist['title'] = $playlistListEntry->title->text;
$playlist['id'] = $playlistListEntry->getPlaylistID();
$playlists[] = $playlist;
$playlistVideoFeed = $yt->getPlaylistVideoFeed($playlistListEntry->getPlaylistVideoFeedUrl());
foreach ($playlistVideoFeed as $videoEntry) {
$playlist_assignment['youtube_id'] = substr($videoEntry->getVideoWatchPageUrl(),31,11);
$playlist_assignment['id'] = $playlist['id'];
$playlist_assignments[] = $playlist_assignment;
}
}
$everything['playlists'] = $playlists;
$everything['playlist_assignments'] = $playlist_assignments;
return $everything;
}
Problem is, this only gets the first page or results. Any ideas on how to use the Zend Gdata to retrieve the next page of results?
The raw gdata XML shows the URLs needed:
<link rel="self" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/pennstate/playlists?start-index=1&max-results=25"/>
<link rel="next" type="application/atom+xml" href="http://gdata.youtube.com/feeds/api/users/pennstate/playlists?start-index=26&max-results=25"/>
However, getPlaylistListFeed doesn't seem to have any parameters to specify "start-index" or "max-results".
This is a useful Zend function for retrieving not only the next page but all available entries for a feed.
$playlistListFeed = $yt->retrieveAllEntriesForFeed($yt->getPlaylistListFeed($userName));