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

Getting inconsistent YouTube API v3 results when using pagination

$
0
0

I'm using the youtube data api v3 in node.js and I am getting inconsistent result set lengths when getting comment threads from a video.

https://developers.google.com/youtube/v3/docs/commentThreads/list

When I query a video with id "dtfW6EP91fY" using code

        var service = google.youtube('v3');        service.commentThreads.list({            auth: auth,            part: "id,snippet,replies",            videoId: "dtfW6EP91fY",            order: "relevance",            maxResults: 100,            pageToken        }, (err, response) => {        });

(on each response, I save the next token and set it back for the next call)

But I get strange result sets. I first see 100 comments, and then I see 1 comment, and then I see 100 comments, and then 1, and it keeps alternating.

Not only that but for the responses that get 1 result, the next page token comes out undefined as well.

How can I get consistent 100 comments?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



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