Zend And YouTube Not Deleting Videos

444 Views Asked by At

Until yesterday I could delete YouTube videos using Zend framework. Now it seems it is not possible.

I was using this code:

$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
               $username, $password, 'youtube', 
               null, 'MySite', null, null, 
              'https://www.google.com/accounts/ClientLogin');

$yt = new Zend_Gdata_YouTube($httpClient, '', '', $myDevKey);

$vid = $yt->getVideoEntry($myVidID, null, true);                                
$yt->delete($vid);

Now I am getting this error:

Expected response code 200, got 410 No longer available

It is the $yt->delete($vid); that causes the problem. Perhaps YouTube has changed, but that used to be working. I tried two other dev keys and youtube accounts and still nothing.

The video is in YouTube and the ID is correct.

1

There are 1 best solutions below

1
Linda Lawton - DaImTo On BEST ANSWER

Zend_Gdata uses ClientLogin which was deprecated as of April 20, 2012 and turned off on May 26 2015. This code will not longer work you need to switch to using Oauth2.

You can use the current Google PHP client library to authenticate then use the access token created there to access it.