我试图用zend显示视频播放列表,但在收到播放列表信息后,我不知道我要查找缩略图或缩略图的网址。
这是我的代码:
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);
}
答案 0 :(得分:0)
至于检索缩略图网址,请查看http://markmail.org/message/heekjb62yxf4skut处的 getMediaArray()功能。
根据您的代码,您可以执行以下操作:
$media = getMediaArray($playlistEntry);
$thumbnail = isset($media['thumbnail']) ? $media['thumbnail'] : false;
这对我有用,我不确定是否有更好的方法,但这是我现在能找到的最好的。