使用youtube api删除播放列表项目

时间:2017-10-15 14:00:18

标签: php youtube-api youtube-data-api

我尝试使用以下方法删除播放列表项:

function deleteVideoFromPlaylist($vid, $youtube) {
  $youtube->playlistItems->delete($vid);
}

function playlistItemsDelete($youtube, $id, $params) {
    $params = array_filter($params);
    $response = $youtube->playlistItems->delete(
        $id,
        $params
    );
    print_r($response);
}

他们两个都在说playlistItemsNotAccessible / Forbidden:

Uncaught exception 'Google_Service_Exception' with message 
'{\n "error": {\n  "errors": [\n   {\n    "domain": 
"youtube.playlistItem",\n    "reason": "playlistItemsNotAccessible",\n 
 "message": "Forbidden",\n    "locationType": "parameter",\n    
"location": "id"\n   }\n  ],\n  "code": 403,\n  "message":
 "Forbidden"\n }\n}\n' in /var/www/html/nextcloud_yt_integration/google-
api-php-client-2.2.0/src/Google/Http/REST.php:118\nStack trace:\n#0 /var/www/html/nextcloud_yt_integration/google-api-php-client-2.2.0/src/Google/Http/REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\\Psr7\\Response), Object(GuzzleHttp\\Psr7\\Request), NULL)\n#1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\\Client), Object(GuzzleHttp\\Psr7\\Request), NULL)\n#2 /var/www/html/nextcloud_yt_integration/google-api-php-client-2.2.0/src/Google/Task/Runner.php(176): call_user_func_array(Array, Array)\n#3 /var/www/html/nextcloud_yt_integration/google-api-php-client-2.2.0/src/Google/Http/REST.php(58): Google_Task_Runner->run()\n#4 /va in /var/www
/html/nextcloud_yt_integration/google-api-php-client-2.2.0/src/Google
/Http/REST.php on line 118

除了这两种方法之外,API资源管理器还说我没有权限这样做 - 所有范围都被授权

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

原来我只是个白痴并且正在授权错误的频道..