0

I trying to show a video playlist with zend, but after catching the playlist info, I don't know what I have to do with for finding thumbnail or url of the thumbnail.

Here is my code:

require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');

 $yt = new Zend_Gdata_YouTube();
 $playlistListFeed = $yt->getPlaylistListFeed('admaltais');

 //step 1: show the playlist name and his URL
 foreach ($playlistListFeed as $playlistEntry) 
 {
    echo $playlistEntry->title->text . "</br></br>";
    echo $playlistEntry->getPlaylistVideoFeedUrl() . "</br></br>";
 }


 //step 2: parse the playlist
 $feedUrl = $playlistEntry->getPlaylistVideoFeedUrl();
 $playlistVideoFeed = $yt->getPlaylistVideoFeed('http://gdata.youtube.com/feeds/api/playlists/B15D7FD35D3814A5');

 foreach ($playlistVideoFeed as $playlistVideoFeedEntry) 
 {
   echo $playlistVideoFeedEntry->title->text . "</br></br>";
   //here i want to retrieve the infos
   //var_dump($playlistVideoFeedEntry);
 }
Termininja
  • 6,620
  • 12
  • 48
  • 49

1 Answers1

0

As far as retrieving the thumbnail URL, have a look at the getMediaArray() function at http://markmail.org/message/heekjb62yxf4skut .

Based on your code, you would do something like:

$media = getMediaArray($playlistEntry);
$thumbnail = isset($media['thumbnail']) ? $media['thumbnail'] : false;

That worked for me and I'm unsure if there's a better way, but this was the best I could find for now.

Amereservant
  • 797
  • 5
  • 8