为什么有时候我无法使用youtube API V3删除订阅?

时间:2019-02-23 16:51:10

标签: youtube-api

我无法使用PHP中的youtube API V3从我的订阅列表中删除某些订阅。

I run "check whether a subscription exists":

我得到了答案:

 **
 * API response
 */
{
  "kind": "youtube#subscriptionListResponse",
  "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/vQg5vcdf3VcnZjlUVNARSwXX8tU\"",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      "kind": "youtube#subscription",
      "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/hMElmhRjuEbIkTVsj4iZTctj0jg\"",
      "id": "lS7ClBpiilG9lCqFDoFRAmEypiwUQCact4W5ovUdXDE",
      "snippet": {
        "publishedAt": "2018-11-24T15:48:13.369Z",
        "title": "Melieca and Kids",

之后,我尝试删除ID为“ lS7ClBpiilG9lCqFDoFRAmEypiwUQCact4W5ovUdXDE”的订阅

function subscriptionsDelete($service, $id, $params) {
        $params = array_filter($params);
        $response = $service->subscriptions->delete(
            $id,
            $params
        );

        print_r($response);
    }

    subscriptionsDelete($service,
        'lS7ClBpiilG9lCqFDoFRAmEypiwUQCact4W5ovUdXDE', array());

来自youtube下的回复:

{
  "error": {
    "errors": [
      {
        "domain": "youtube.subscription",
        "reason": "subscriptionNotFound",
        "message": "The subscription that you are trying to delete cannot be found. Check the value of the requests id parameter to ensure that it is correct."
      }
    ],
    "code": 404,
    "message": "The subscription that you are trying to delete cannot be found. Check the value of the requests id parameter to ensure that it is correct."
  }
}

0 个答案:

没有答案