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

Combine gplay.list and gplay.search?

Open danpostmail92 opened this issue 3 years ago • 4 comments

Hi There,

Is is possible to use the gplay.list and gplay.search together as way to search for terms in a specific category and retrieve full detail on apps? i.e.

var gplay = require('google-play-scraper'); var util = require('util');

gplay.list({ category: gplay.category.COMMUNICATION, })

util.inspect.defaultOptions.maxArrayLength = null;

gplay.search({ term: "Video Call", fullDetail: true, throttle: 60, num: 250, })

.then (console.log)

Thanks

danpostmail92 avatar Jan 08 '21 10:01 danpostmail92

What list does is basically fetch every app for a given category/collection, like this link, for example.

About search, it literally searches for a term at gplay.

Maybe what you can do is:

  • Run search with your term and the fullDetail option set to true (be aware that one request will be made for every app to get the full detail)
  • Filter the results per genreId (this is the category) of the app.

Does this suits your needs?

icarcal avatar Jan 08 '21 14:01 icarcal

Thanks Icarcal for your prompt reply. For my very limited amount of scripting knowledge, by 'filter the results per genreId of the app' do you mean that I could add the genreID to my gplay.search command and the output would only be results showing 'Video Call' where the generid = category?

Can I specify the genreID: or a filter parameter within gplay.search? i.e.

gplay.search({ term: "Video Call", fullDetail: true, throttle: 60, num: 250, genreID: COMMUNICATION

Essentially what I am trying to do is only return the apps that have 'video call' in gplay that are assigned to the 'communication' category - I thought this would be a good way of reducing the results due to the num max being 250.

As a side question, can I have multiple terms specified in "term:" i.e. "Video Call" "Voice Call" "Messages", would it use AND/OR statements?

Thanks, Daniel

danpostmail92 avatar Jan 09 '21 00:01 danpostmail92

This should do what you want:

(async () => {
  const results = await gplay.search({
    term: "Video Call",
    fullDetail: true,
    throttle: 60,
    num: 250,
  });

  const communicationResultsOnly = results.filter((app) => app.genreId === gplay.category.COMMUNICATION)

  console.log(communicationResultsOnly);
})()

or

 gplay.search({
    term: "Video Call",
    fullDetail: true,
    throttle: 60,
    num: 250,
 }).then((results) => {
  const communicationResultsOnly = results.filter((app) => app.genreId === gplay.category.COMMUNICATION)
  console.log(communicationResultsOnly);
});

Be aware that one request will be made for every app to get the full detail (for example, we need 4 request to get the 250 apps, and 250 requests to get the full detail for each, so this code will execute 254 calls to gplay).

As a side question, can I have multiple terms specified in "term:" i.e. "Video Call" "Voice Call" "Messages", would it use AND/OR statements?

You can only specify one term per .search call

icarcal avatar Jan 12 '21 01:01 icarcal

Hey, @danpostmail92 did you manage to do what you wanted?

icarcal avatar Jan 18 '22 15:01 icarcal