google-play-scraper
google-play-scraper copied to clipboard
Combine gplay.list and gplay.search?
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
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 thefullDetail
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?
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
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
Hey, @danpostmail92 did you manage to do what you wanted?