I struggled with this for several hours and I have no idea why it is not working. I need to get information from VideoID using the YouTube and Zend APIs, so I created a function like
function listYoutubeVideo($id) { $videos = array(); try { $yt = new Zend_Gdata_YouTube(); $videoFeed = $yt->getVideoEntry($id); foreach ($videoFeed as $videoEntry) { $videoThumbnails = $videoEntry->getVideoThumbnails(); $videos[] = array( 'thumbnail' => $videoThumbnails[0]['url'], 'title' => $videoEntry->getVideoTitle(), 'description' => $videoEntry->getVideoDescription(), 'tags' => implode(', ', $videoEntry->getVideoTags()), 'url' => $videoEntry->getVideoWatchPageUrl(), 'flash' => $videoEntry->getFlashPlayerUrl(), 'dura' => $videoEntry->getVideoDuration(), 'id' => $videoEntry->getVideoId() ); } } catch (Exception $e) { } return $videos; }
The reason I am doing this with an array and a function is because I want to cache this function.
I have no idea what is wrong with the code, I use exactly the same, just changing getVideoEntry for other types of feeds, and it works.
source share