google-play/node_modules/google-play-scraper/lib/search.js
/*
 * If already have requested results or there are no more pages, return current
 * app list, otherwise request the ajax endpoint of the next page and process
 * the results.
 */
If already have requested results or there are no more pages, return current
app list, otherwise request the ajax endpoint of the next page and process
the results.
If already have requested results or there are no more pages return current app list otherwise request the ajax endpoint of the next page and process the results .
function checkFinished (opts, savedApps, nextToken) {
  if (savedApps.length >= opts.num || !nextToken) {
    return savedApps.slice(0, opts.num);
  }
  const requestOptions = Object.assign({
    url: 'https://play.google.com/_/PlayStoreUi/data/batchexecute?rpcids=qnKhOb&bl=boq_playuiserver_20190424.04_p0&hl=en&gl=us&authuser=0&soc-app=121&soc-platform=1&soc-device=1',
    method: 'POST',
    body: body.replace('%token%', nextToken),
    followAllRedirects: true,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
    }
  }, opts.requestOptions);
  return request(requestOptions, opts.throttle)
      .then((html) => {
        const input = JSON.parse(html.substring(5));
        const data = JSON.parse(input[0][2]);
        return processAndRecur(data, opts, savedApps, REQUEST_MAPPINGS);
      });
}
function checkFinished ( opts , savedApps , nextToken ) { if ( savedApps . length >= opts . num || ! nextToken ) { return savedApps . slice ( 0 , opts . num ) ; } const requestOptions = Object . assign ( { url : 'https://play.google.com/_/PlayStoreUi/data/batchexecute?rpcids=qnKhOb&bl=boq_playuiserver_20190424.04_p0&hl=en&gl=us&authuser=0&soc-app=121&soc-platform=1&soc-device=1' , method : 'POST' , body : body . replace ( '%token%' , nextToken ) , followAllRedirects : true , headers : { 'Content-Type' : 'application/x-www-form-urlencoded;charset=UTF-8' } } , opts . requestOptions ) ; return request ( requestOptions , opts . throttle ) . then ( ( html ) => { const input = JSON . parse ( html . substring ( 5 ) ) ; const data = JSON . parse ( input [ 0 ] [ 2 ] ) ; return processAndRecur ( data , opts , savedApps , REQUEST_MAPPINGS ) ; } ) ; }
If already have requested results or there are no more pages, return current
 app list, otherwise request the ajax endpoint of the next page and process
 the results.
If already have requested results or there are no more pages return current app list otherwise request the ajax endpoint of the next page and process the results .