ZF-9479: Zend_Gdata_Youtube does not work with v2.0 API
Try the following code:
require_once 'Zend/Gdata/Youtube.php'; $yt = new Zend_Gdata_YouTube(); $yt->setMajorProtocolVersion(2); $query = $yt->newVideoQuery(); $query->videoQuery = 'zend framework'; $query->startIndex = 0; $query->maxResults = 10; $query->orderBy = 'viewCount'; $query->safeSearch = 'strict'; $videoFeed = $yt->getVideoFeed($query);
The 2.0 headers are properly sent but the query is still generated with 1.0 params. After doing some research I found out that the "getQueryUrl"-function in Zend_Gdata_YouTube_VideoQuery can have 2 arguments with version numbers. The function which calls this (getVideoFeed() in Zend_Gdata_YouTube) does NOT provide the version at all so it will never trigger the function to use 2.0 params instead of 1.0 params.
I changed line 259 in Zend_Gdata_YouTube from:
$uri = $location->getQueryUrl();
$uri = $location->getQueryUrl($this->getMajorProtocolVersion());
to make it work for now but changing the library myself isnt a very wise thing to do. I suggest this will be taken care of quickly since the 2.0 version seems useless for Zend Framework right now. If I am wrong about the usage of this please document this (better).