PhpRiot
Follow phpriot on Twitter
Sponsored Link
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
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

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 451. 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 452. Retrieving a specific playlist

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

Zend Framework