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

I am trying to get any youtube channel's subscribed users list and their detail(analysis), like the XYZ channel has 45% male users subscriber and 55% female users subscriber, this channel was subscribed by this top 5 countries subscriber and the channel Audience Demography related information.

For this, I use YouTube Analytics API v3 and my URL is like

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

but this URL return below code in response

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

I don't know I'm right or wrong for the use of this URL for getting the above detail. I did read all the questions about youtube data API but I did not find my question's answer on those questions.

Thanks in advance.

1 answer

  • answered 2020-07-04 11:16 stvar

    According to 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.

    Therefore, do change your URL above to:

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