country switching is not working
yarafan opened this issue ยท 5 comments
Hi. When I switch countryCode the results remains the same.
api = require("./node-google-play/index.js").GooglePlayAPI({ username: "....", password: "...", androidId: "....", countryCode: 'ru', language: 'ru_RU', }); api.executeRequestApi("search", {c:3, n: 20, o: 0, q: "tattoo"} ).then(function(res) { console.log(res.payload.searchResponse.doc[0].child.map(function(el) { return el.docid })); });
It produces the same results as if I completely omit countryCode or language.
You'll need to check your login's country
So Google Play results infer country from my profile rather than set explicitly?
Maybe it is possible to override my country?
I'd really appreciate your help.
After some experiments i found out that results mostly depend on ip (i used tor for different ips)
Can you share method change countryCode via tor ? Thanks
https://github.com/mattcg/socks5-http-client#using-with-request
You can find answer there. Under the hood gpapi use "request module" so you can do something like this:
var Agent = require('socks5-http-client/lib/Agent');
var api = require('gpapi').GooglePlayAPI({
username: user,
password: pass,
androidId: android_id,
requestsDefaultParams: {
agentClass: Agent,
agentOptions: {
socksHost: 'localhost', // tor host
socksPort: 9050 // tor port.
}
},
});
If you have any questions I would be glad to answer.
But I should note that tor doesn't let you choose exit node country, so you won't get deterministic results for specific country (unless you edit .torrc "on the fly" to choose exact exit nodes, but that is another question).