Zend 和 YouTube 不删除视频
Zend And YouTube Not Deleting Videos
直到昨天我才可以使用 Zend 框架删除 YouTube 视频。现在看来是不行了
我正在使用此代码:
$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);
现在我收到这个错误:
Expected response code 200, got 410 No longer available
导致问题的是 $yt->delete($vid);
。或许 YouTube 已经改变,但它曾经是有效的。我尝试了另外两个开发密钥和 youtube 帐户,但仍然一无所获。
视频在 YouTube 上,ID 正确。
Zend_Gdata 使用 ClientLogin,它已于 2012 年 4 月 20 日弃用并于 2015 年 5 月 26 日关闭。此代码将不再有效,您需要切换到使用 Oauth2。
您可以使用当前的 Google PHP client library 进行身份验证,然后使用在那里创建的访问令牌进行访问。
直到昨天我才可以使用 Zend 框架删除 YouTube 视频。现在看来是不行了
我正在使用此代码:
$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);
现在我收到这个错误:
Expected response code 200, got 410 No longer available
导致问题的是 $yt->delete($vid);
。或许 YouTube 已经改变,但它曾经是有效的。我尝试了另外两个开发密钥和 youtube 帐户,但仍然一无所获。
视频在 YouTube 上,ID 正确。
Zend_Gdata 使用 ClientLogin,它已于 2012 年 4 月 20 日弃用并于 2015 年 5 月 26 日关闭。此代码将不再有效,您需要切换到使用 Oauth2。
您可以使用当前的 Google PHP client library 进行身份验证,然后使用在那里创建的访问令牌进行访问。