google-play-scraper icon indicating copy to clipboard operation
google-play-scraper copied to clipboard

Variable number of reviews returned

Open gianlucascoccia opened this issue 10 months ago • 2 comments

The reviews methods seems to return a different number of reviews on each call. I slightly modified the example in the documentation to reproduce the issue:

import gplay from "google-play-scraper";

gplay.reviews({
  appId: 'com.facebook.katana',
  num: 3000
}).then(function(apps){
  console.log(apps.data.length);
}, console.log);

When called multiple times the output is :

300
300
150
150
150
150
1200

This used to work in the past, getting hundreds of thousands of reviews in a single call

gianlucascoccia avatar Apr 03 '24 10:04 gianlucascoccia

In this sister project they have encountered the same issue. Here I provided a workaround around the issue that appears to be working. I would submit a PR to fix the issue but my JavaScript skills are fairly limited.

gianlucascoccia avatar Apr 04 '24 09:04 gianlucascoccia

comment edited - pagination is built-in, just implement cookieJar

Variance in response seems to come from Google's loadbalancer picking different backend that doesn't know about our nextPaginationToken and responds with error. Providing NID cookie (that stores user prefs & ad data) gives me constant results.

PR on the way, in a meanwhile you can test with my fork.

petskratt avatar Apr 06 '24 19:04 petskratt