Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Can't retrieve more than 1000 subscribers with mySubscribers parameter

$
0
0

I am trying to retrieve a complete list of the channels subscribed to the authorized user.

According to Subscriptions: list:

To retrieve a complete list of subscribers, use the mySubscribers parameter. That parameter, which does not return subscribers in a particular order, does not limit the number of subscribers that can be retrieved.

However, even with this parameter, I am limited to retrieving 1000 results.

I am using Node.js. My parameters are the following:

{'params': {'part': 'snippet,contentDetails,subscriberSnippet','mySubscribers': true,'maxResults': 50 }};

The request goes to this URL:

https://www.googleapis.com/youtube/v3/subscriptions?part=snippet%2CcontentDetails%2CsubscriberSnippet&mySubscribers=true&maxResults=50

According to the pageInfo:

"pageInfo": {"totalResults": 12954,"resultsPerPage": 50},

I continue to request using nextPageToken:

function subscriptionsListByChannelId(auth, requestData) {  var service = google.youtube('v3');  var parameters = removeEmptyParameters(requestData['params']);  parameters['auth'] = auth;  service.subscriptions.list(parameters, function(err, response) {    if (err) {      console.log('The API returned an error: '+ err);      return;    }    console.log(response);    if (response.data.nextPageToken) {        var newParams = {'params': {'part': 'snippet,contentDetails,subscriberSnippet','mySubscribers': true,'maxResults': 50,'pageToken': response.data.nextPageToken      }};      authorize(content, newParams, subscriptionsListByChannelId);    }  });}

response.data.nextPageToken becomes undefined after exactly 1000 subscribers, meaning it has reached the last page.

I cannot figure out why it stops at this point. According to the documentation, I should be able to retrieve all subscribers, not just 1000. I have tried every combination of parameters I can think of, but nothing changes.

EDIT: For anyone stumbling across this question in the future, I noticed Channels: list gets more than 1000 subscribers, despite the mySubscribers parameter being deprecated. By switching the API, you can retrieve more subscribers, although they are about 72% duplicates. Because of the issues of both APIs, I don't see this as the solution.


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>