Skip to content

Instantly share code, notes, and snippets.

@keeganbrown
Created May 28, 2013 19:30
Show Gist options
  • Save keeganbrown/5665429 to your computer and use it in GitHub Desktop.
Save keeganbrown/5665429 to your computer and use it in GitHub Desktop.
youtube Process playlist feeds
private function processPlaylistFeeds($playlistListFeed) {
$playListArray = array();
foreach ($playlistListFeed as $playlistListEntry) {
$plid = $playlistListEntry->playlistId->text;
$playListArray[$plid] = array();
$playListArray[$plid]['title'] = htmlspecialchars( $playlistListEntry->title->text );
$playListArray[$plid]['id'] = $playlistListEntry->playlistId->text;
$playListArray[$plid]['description'] = htmlspecialchars( $playlistListEntry->getDescription() );
$playListArray[$plid]['url'] = $playlistListEntry->getPlaylistVideoFeedUrl();
$playListArray[$plid]['videos'] = array();
$playlistVideoFeed = $this->yt->getPlaylistVideoFeed( $playlistListEntry->getPlaylistVideoFeedUrl() );
foreach ($playlistVideoFeed as $playlistVideoEntry) {
$id = $playlistVideoEntry->getVideoId();
$playListArray[$plid]['videos'][$id] = array();
$playListArray[$plid]['videos'][$id]['id'] = $id;
$playListArray[$plid]['videos'][$id]['title'] = htmlspecialchars( $playlistVideoEntry->getVideoTitle() );
$playListArray[$plid]['videos'][$id]['desc'] = htmlspecialchars( $playlistVideoEntry->getVideoDescription() );
}
}
return $playListArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment