From 6a4e17dfeb36e27606f06848b5e0865daa41af96 Mon Sep 17 00:00:00 2001 From: cristianoying <39425195+Cristianoying@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:19:42 +0800 Subject: [PATCH] feat(permissions): add default country and update URL (#695) --- README.md | 1 + lib/permissions.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c7f4748a..52af0846 100644 --- a/README.md +++ b/README.md @@ -431,6 +431,7 @@ Returns the list of permissions an app has access to. * `appId`: the Google Play id of the application to get permissions for. * `lang` (optional, defaults to `'en'`): the two letter language code in which to fetch the permissions. +* `country` (optional, defaults to `'us'`): the two letter country code in which to fetch the permissions. * `short` (optional, defaults to `false`): if `true`, the permission names will be returned instead of permission/description objects. diff --git a/lib/permissions.js b/lib/permissions.js index bd55577a..6566a123 100644 --- a/lib/permissions.js +++ b/lib/permissions.js @@ -13,6 +13,7 @@ function permissions (opts) { } opts.lang = opts.lang || 'en'; + opts.country = opts.country || 'us'; processPermissions(opts) .then(resolve) @@ -22,7 +23,7 @@ function permissions (opts) { function processPermissions (opts) { const body = `f.req=%5B%5B%5B%22xdSrCf%22%2C%22%5B%5Bnull%2C%5B%5C%22${opts.appId}%5C%22%2C7%5D%2C%5B%5D%5D%5D%22%2Cnull%2C%221%22%5D%5D%5D`; - const url = `${BASE_URL}/_/PlayStoreUi/data/batchexecute?rpcids=qnKhOb&f.sid=-697906427155521722&bl=boq_playuiserver_20190903.08_p0&hl=${opts.lang}&authuser&soc-app=121&soc-platform=1&soc-device=1&_reqid=1065213`; + const url = `${BASE_URL}/_/PlayStoreUi/data/batchexecute?rpcids=qnKhOb&f.sid=-697906427155521722&bl=boq_playuiserver_20190903.08_p0&hl=${opts.lang}&gl=${opts.country}&authuser&soc-app=121&soc-platform=1&soc-device=1&_reqid=1065213`; debug('batchexecute URL: %s', url); debug('with body: %s', body);