PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Retrieving playlist feeds

The YouTube Data API provides information about users, including profiles, playlists, subscriptions, and more.

Retrieving the playlists of a user

The library provides a helper method to retrieve the playlists associated with a given user. To retrieve the playlists for the user 'liz':

Example 465. Retrieving the playlists of a user

<?php
$yt 
= new Zend_Gdata_YouTube();
$playlistListFeed $yt->getPlaylistListFeed('liz');

foreach (
$playlistListFeed as $playlistEntry) {
    echo 
$playlistEntry->title->text "\n";
    echo 
$playlistEntry->description->text "\n";
    echo 
$playlistEntry->getPlaylistVideoFeedUrl() . "\n\n\n";
}

Retrieving a specific playlist

The library provides a helper method to retrieve the videos associated with a given playlist. To retrieve the playlists for a specific playlist entry:

Example 466. Retrieving a specific playlist

<?php
$feedUrl 
$playlistEntry->getPlaylistVideoFeedUrl();
$playlistVideoFeed $yt->getPlaylistVideoFeed($feedUrl);

Zend Framework