如何使用 YouTube Analytics API 获取任何 Youtube 频道的订阅用户列表及其详细信息?

How to get any Youtube channel's subscribed users list and their details using YouTube Analytics API?

我正在尝试获取任何 YouTube 频道的订阅用户列表及其详细信息(分析),例如 XYZ 频道有 45% 的男性用户订阅者和 55% 的女性用户订阅者,这个频道是由前 5 个国家的订阅者订阅的以及频道受众人口统计相关信息。

为此,我使用 YouTube Analytics API v3,我的 URL 就像

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet,contentDetails,subscriberSnippet&key=APIKEY&id=CHANNELID

但是下面的 URL return 代码作为响应

{
    {
      "kind": "youtube#SubscriptionListResponse",
      "etag": "TOmVRCZpu2meG82Dv9k7Y-QQ8t888",
      "pageInfo": {
      "totalResults": 0,
      "resultsPerPage": 5
   },
   "items": []
}

我不知道使用此 URL 获取上述详细信息是对还是错。我确实阅读了有关 youtube 数据的所有问题 API,但我没有找到关于这些问题的答案。

提前致谢。

根据the docs, if your intention is to obtain subscriptions info w.r.t. a given channel -- identified by its channel ID --, then you should use the parameter channelId

channelId (string)

The channelId parameter specifies a YouTube channel ID. The API will only return that channel's subscriptions.

因此,请将上面的 URL 更改为:

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet,contentDetails,subscriberSnippet&key=APIKEY&channelId=CHANNELID.

您请求的数据类型属于频道的私有数据。只有当您是该频道的所有者(通过授权 - Oauth2)或者频道所有者允许您通过公开可用的应用程序访问该数据(在通过授权后)时,您才能访问此类数据。