Code Monkey home page Code Monkey logo

node-google-play's Introduction

NPM

Build Status npm

For a rust version of this library check out rs-gpapi.

SYNOPSIS

Call Google Play APIs from Node. You might want to check out the CLI package as well.

By default behaves like a Nexus device with SDK 23 for app downloads.

USAGE

var api = require('gpapi').GooglePlayAPI({
  username: user,
  password: pass,
  androidId: android_id
  // apiUserAgent: optional API agent override (see below)
  // downloadUserAgent: optional download agent override (see below)
});

// usage via Promise
api.details("com.viber.voip").then(console.log);

// usage via node callback convention
api.details("com.viber.voip", function (err, res) {
  console.log(err ? err : res);
});

Options

The options accepted:

{
  username: username,
  password: password,
  androidId: androidId,
  countryCode: 'us',
  language: 'en_US',
  requestsDefaultParams: requestsDefaultParams,
  apiUserAgent: USER_AGENT,
  downloadUserAgent: DOWNLOAD_MANAGER_USER_AGENT,
  useCache:true,
  debug: false
}

Defaults

The default apiUserAgent and downloadUserAgent is from Nexus 5X device, w/ Play Store version 6.8.44:

e.g.,:

const USER_AGENT = (
    'Android-Finsky/6.8.44.F-all%20%5B0%5D%203087104 ' +
    '(api=3,versionCode=80684400,sdk=23,device=bullhead,'+
    'hardware=bullhead,product=bullhead,platformVersionRelease=6.0.1,'+
    'model=Nexus%205X,buildId=MHC19Q,isWideScreen=0)'
);

const DOWNLOAD_MANAGER_USER_AGENT = (
  'AndroidDownloadManager/6.0.1 (Linux; U; Android 6.0.1; Nexus 5X Build/MHC19Q)'
);

Therefore you will have best luck getting an ANDROID_ID from a Nexus 5X or override the value via the options object for your particular device.

ID and User-Agent

Note that you'll need to grab the device-id (ANDROID_ID) and associated user-agents for best performance of the library.

  • ANDROID_ID - the ID for the device for Google. This is the GSF ID not the id from dialing *#*#8255#*#*. You can get the gsf id e.g., using this following app: device id app WARNING: This is not the androidId but the GSF Id that is needed by the library

  • Another way is to setup an HTTP proxy and install a CA to the device to see the network traffic. Here is an example from a mitmproxy session:

Device ID and API User-Agent

Download User-Agent

These values can then be passed to the API so that apps can be downloaded with the restrictions of the particular device.

requests defaults

Note that this library uses the requests module, therefore you can control proxy behavior or override defaults via the requestDefaultsParams option.

Debugging

Use env variable DEBUG i.e., DEBUG=gp:api to enable debug output. This is done via request-debug.

You can provide the debug option too.

{
  username: username,
  password: password,
  androidId: androidId,
  debug: false
}

EXAMPLES

Assumes you have set the following environment variables: GOOGLE_LOGIN, GOOGLE_PASSWORD, ANDROID_ID

App details

± % node examples/details.js | jq '.'
{
  "docid": "com.viber.voip",
  "backendDocid": "com.viber.voip",
  "docType": 1,
  "backendId": 3,
  "title": "Viber",
  "creator": "Viber Media S.à r.l.",
  "descriptionHtml": "With Viber, everyone in the world can connect. Freely. More than 400 million Viber users text, call, and send photo and video messages worldwide over Wifi or 3G - for free. Viber Out can be used to make calls to non-Viber mobile and landline numbers at low rates. Viber is available for many smartphones and platforms.   <p>Viber is compatible with and optimized for Android tablets! Use Viber on your tablet and phone simultaneously.<br>On Viber, your phone number is your ID. The app syncs with your mobile contact list, automatically detecting which of your contacts have Viber. <p>•\tText with your friends<br>•\tMake free calls with HD sound quality<br>•\tPhoto sharing, video messages, voice messages, locations, stickers and emoticons<br>•\tGroups with up to 100 participants<br>•\tDownload stickers from the Sticker Market, making messaging fun! <br>•\tAbility to sort and reorder stickers<br>•\tPush notifications guarantee that you never miss a message or call, even when Viber is off<br>•\tIntegration with native contact list for calls and messages<br>•\tSupport for the Viber Desktop application on Windows and Mac <br>Localized to: Arabic, Catalan, Chinese (SP), Chinese (TR), Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hebrew, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese (BR), Portuguese (PT), Romanian, Russian, Slovak, Spanish, Swedish, Tagalog, Thai, Turkish, Ukrainian and Vietnamese<br>Viber is completely free with no advertising. <br>We value your privacy. <p>Follow us for updates and news:<br>Facebook - <a href=\"https://www.google.com/url?q=http://facebook.com/viber&amp;sa=D&amp;usg=AFQjCNGlVhJn65339uldBAp6MeFXZIV3mA\" target=\"_blank\">http://facebook.com/viber</a><br>Twitter - <a href=\"https://www.google.com/url?q=http://twitter.com/viber&amp;sa=D&amp;usg=AFQjCNG60qtBs85Z7vg5eeagjANxTrdSjQ\" target=\"_blank\">http://twitter.com/viber</a><p>(*) Network data charges may apply",
  "offer": [
    {
      "micros": "0",
      "currencyCode": "USD",
      "formattedAmount": "Free",
      "checkoutFlowRequired": false,
      "offerType": 1
    }
  ],
 ...

Related apps

± % node examples/related.js | jq '.'
[
  {
    "backendId": 3,
    "title": "Similar apps",
    "child": [
      {
        "docid": "com.skype.raider",
        "backendDocid": "com.skype.raider",
        "docType": 1,
        "backendId": 3,
        "title": "Skype - free IM & video calls",
        "creator": "Skype",
        "offer": [
          {
            "micros": 0,
            "currencyCode": "USD",
            "formattedAmount": "Free",
            "checkoutFlowRequired": false,
            "offerType": 1
          }
        ],
        "availability": {
          "restriction": 1,
          "perdeviceavailabilityrestriction": [
            {
              "androidId": xxxxxxxxxxxxxxx9983,
              "deviceRestriction": 1,
              "channelId": 83938807
            }
          ],
          "availableIfOwned": true
        },
        ...
      }
  }
]

Download info

± % node examples/downloadInfo.js | jq '.'
{
  "url": "https://android.clients.google.com/market/download/Download?packageName=air.WatchESPN&versionCode=2100039&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw&downloadId=yyyyyyyyyyyyyyyyyyyy",
  "cookies": [
    {
      "name": "MarketDA",
      "value": "zzzzzzzzzzzzzzzzzzzz"
    }
  ]
}

Complete Download info - complete object to be passed seamlessly to request.js

± % node examples/completeDownloadInfo.js | jq '.'
{ url: 'https://android.clients.google.com/market/download/Download?packageName=com.viber.voip&versionCode=37&ssl=1&token=xxxxxxxxx&downloadId=-xxxxxxxxxxx',
  jar:
   RequestJar {
     _jar:
      CookieJar {
        enableLooseMode: true,
        store: { idx: { 'android.clients.google.com': { '/market/download': { MarketDA: Cookie="MarketDA=xxxxxxxx; Path=/market/download; hostOnly=true; aAge=29ms; cAge=29ms" } } } } } },
  headers: 
   { 'User-Agent': 'AndroidDownloadManager/4.2.2 (Linux; U; Android 4.2.2; Galaxy Nexus Build/JDQ39)',
     'Accept-Encoding': '' } }

NOTES

node-google-play's People

Contributors

dainis avatar dependabot[bot] avatar dweinstein avatar honktang avatar id0sch avatar jfrumar avatar mistefr avatar newhouse avatar orgoldfus avatar ralphtheninja avatar sudhakar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-google-play's Issues

Error retrieving information from server

I could execute search.js successfully, while when I try to download a free app with download.js. It always shows an error:

Unhandled rejection RequestError: Error retrieving information from server. [DF-RPC-01]
at handleErr (/tmp/node-google-play/lib/api.js:212:31)

unauthorized after the server has been up for a while

Hi,
recently we started receiving an unauthorized error and we noticed that it occurs after our server has been up for a while (our server acts as a middle-man for your lib).
i remember that the login method checks if authToken exists and if it does it returns, i think that this approach causes errors since authTokens seem to expire.
i will try to figure out a solution and maybe i will submit a PR, but i would like if you would give it attention as well...
thanks !

Questions on Search Usage/Results

  1. How could I use the search function to search by a specific attribute value?
  2. How can I retrieve the nextPageUrl value in the response object and navigate to it?
  3. When I search with just a term (i.e. "T-Mobile") only some of the applications show up, along with a bunch of irrelevant ones. If I search the T-Mobile applications that are missing from the response list, I have to do it by their full names which then show up but exclude the original ones in the response JSON.

Google changed headers

Sometimes google returns 'content-type': 'application/binary' instead of 'application/protobuf', so

assert(res.headers['content-type'] === 'application/protobuf', 'not application/protobuf response');

fails, however their response is still same protobub

Unhandled rejection LoginError: Error=NeedsBrowser

I'm getting this error.
`Unhandled rejection LoginError: Error=NeedsBrowser

ErrorDetail=To access your account, you must sign in on the web. Touch Next to start browser sign-in.
at node-google-play-master/lib/api.js:154:15
at tryCatcher (node-google-play-master/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (node-google-play-master/node_modules/bluebird/js/release/promise.js:501:35)
at Promise._settlePromise (node-google-play-master/node_modules/bluebird/js/release/promise.js:561:18)
at Promise._settlePromise0 (node-google-play-master/node_modules/bluebird/js/release/promise.js:606:10)
at Promise._settlePromises (node-google-play-master/node_modules/bluebird/js/release/promise.js:685:18)
at Promise._fulfill (node-google-play-master/node_modules/bluebird/js/release/promise.js:630:18)
at PromiseArray._resolve (node-google-play-master/node_modules/bluebird/js/release/promise_array.js:125:19)
at PromiseArray._promiseFulfilled (node-google-play-master/node_modules/bluebird/js/release/promise_array.js:143:14)
at PromiseArray._iterate (node-google-play-master/node_modules/bluebird/js/release/promise_array.js:113:31)
at PromiseArray.init as _init
at Promise._settlePromise (node-google-play-master/node_modules/bluebird/js/release/promise.js:558:21)
at Promise._settlePromise0 (node-google-play-master/node_modules/bluebird/js/release/promise.js:606:10)
at Promise._settlePromises (node-google-play-master/node_modules/bluebird/js/release/promise.js:685:18)
at Promise._fulfill (node-google-play-master/node_modules/bluebird/js/release/promise.js:630:18)
at Request._callback (node-google-play-master/node_modules/bluebird/js/release/nodeback.js:45:21)
`

Login completely failing for 100%?

I've seen now 100% of the login attempt gets 403 error...
Tried with multiple real accounts/devices from multiple IP addresses but no luch.

Any solution you can imagine is appreciated.

Simple way to reproduce:

curl -v -X POST 'https://android.clients.google.com/auth' \
-d '[email protected]&Passwd=xxxx&androidId=xxxx&service=androidmarket&accountType=HOSTED_OR_GOOGLE&has_permission=1&source=android&app=com.android.vending&device_country=us&operatorCountry=us&sdk_version=26'

deliveryResponse with a status of 3

A number of downloads are coming back with a deliveryResponse with a status of 3 and an empty appDeliveryData. Does anyone know what a status of 3 means?

lack of lib/data/googleplay.proto

I an new to Node.js. When I run a example, the error is shown:
/home/work/git/node-google-play/lib/api.js:16
const ResponseWrapper = builder.build('ResponseWrapper');
^
TypeError: Cannot read property 'build' of null
at Object. (/home/work/git/node-google-play/lib/api.js:16:32)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/work/git/node-google-play/examples/common-api-init.js:1:104)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)

I checked the node, it seems api.js use the /data/googleplay.proto, but it does not exist.

RequestError for paid apps

± gp-download-info com.mojang.minecraftpe
RequestError: The Play Store application on your device is outdated and does not support this purchase.

authToken option?

I see the authToken option - could you inform how I obtain this so that I can set it? I tried getting something from the google oauth 2.0 playground, but it doesnt work (i.,e I get a RequestError in the response). Thanks!

Debug function is overloaded as a boolean and causing crashes

Our service is crashing with this error:

api_server-v1.0.0.forever.log-TypeError: boolean is not a function api_server-v1.0.0.forever.log: at null.<anonymous> (/var/www/groupahead-backend/node_modules/gpapi/lib/api.js:240:13) api_server-v1.0.0.forever.log- at wrappedCallback (/var/www/groupahead-backend/node_modules/newrelic/lib/transaction/tracer/index.js:321:23) api_server-v1.0.0.forever.log- at wrapped (/var/www/groupahead-backend/node_modules/newrelic/lib/transaction/tracer/index.js:155:28) api_server-v1.0.0.forever.log- at wrappedCallback (/var/www/groupahead-backend/node_modules/newrelic/lib/transaction/tracer/index.js:412:66) api_server-v1.0.0.forever.log- at wrapped [as _onTimeout] (/var/www/groupahead-backend/node_modules/newrelic/lib/transaction/tracer/index.js:155:28) api_server-v1.0.0.forever.log- at Timer.unrefdHandle (timers.js:307:14)

It looks like the debug var both refers to the debug module, and the debug boolean passed to the main function:

https://github.com/dweinstein/node-google-play/blob/master/lib%2Fapi.js#L254

Missing FAMILY category

Hi,

I have been playing with the category APIs to check the available categories.

These are the categories i have been able to collect:

["ANDROID_WEAR", "ART_AND_DESIGN", "AUTO_AND_VEHICLES", "BEAUTY",
"BOOKS_AND_REFERENCE", "BUSINESS", "COMICS", "COMMUNICATION", "DATING",
"EDUCATION", "ENTERTAINMENT", "EVENTS", "FINANCE", "FOOD_AND_DRINK", "GAME",
"HEALTH_AND_FITNESS", "HOUSE_AND_HOME", "LIBRARIES_AND_DEMO", "LIFESTYLE",
"MAPS_AND_NAVIGATION", "MEDICAL", "MUSIC_AND_AUDIO", "NEWS_AND_MAGAZINES",
"PARENTING", "PERSONALIZATION", "PHOTOGRAPHY", "PRODUCTIVITY", "SHOPPING",
"SOCIAL", "SPORTS", "TOOLS", "TRAVEL_AND_LOCAL", "VIDEO_PLAYERS", "WEATHER"]

Additionally games are also sub-divided in:
["Action", "Adventure", "Arcade", "Board", "Card", "Casino", "Casual",
"Educational", "Family", "Music", "Puzzle", "Racing", "Role Playing",
"Simulation", "Sports", "Strategy", "Trivia", "Word"]

Unfortunately the FAMILY category seems to be missing. I have seen in the GP scraper API and in the store:

https://play.google.com/store/apps/category/FAMILY?age=AGE_RANGE2&hl=en
https://play.google.com/store/apps/category/FAMILY_CREATE?hl=en

I wonder if anyone came across this missing category already and in case it really isnt available (via android.clients api), are there any known alternatives to retrieve them?

Thanks!

DownloadInfo/Download Seems Broken

google's api seems to return status code 500 when you do downloadInfo request.

the is error i got
node .\downloadInfo.js
Possibly unhandled RequestError: ↕K↕IError retrieving information from server. [RPC:S-7:AEC-0 RLD2-NXJV-FNI3E]�☺
at D:\github\node-google-play\lib\api.js:203:17
at tryCatchApply (D:\github\node-google-play\node_modules\bluebird\js\main\util.js:77:21)
at Promise$_callSpread as _callSpread
at Promise$_callHandler as _callHandler
at Promise$_settlePromiseFromHandler as _settlePromiseFromHandler
at Promise$_settlePromiseAt as _settlePromiseAt
at Promise$_settlePromises as _settlePromises
at Async$_consumeFunctionBuffer as _consumeFunctionBuffer
at Async$consumeFunctionBuffer (D:\github\node-google-play\node_modules\bluebird\js\main\async.js:40:14)
at process._tickCallback (node.js:419:13)

country switching is not working

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.

Search offset doesn't work

Seems that "offset" param in the search() method doesn't do anything.

The code below produces the following results:

client.search('facebook', 5, 0)
  .then((results) => {
    console.log(results[0].child.map((e) => e.details.appDetails.packageName));
  })
[ 'com.facebook.katana',
  'com.facebook.lite',
  'com.facebook.orca',
  'com.facebook.work',
  'com.facebook.stickered' ]

But when I change the offset from 0 to 5 I still get the same results.

client.search('facebook', 5, 5)
  .then((results) => {
    console.log(results[0].child.map((e) => e.details.appDetails.packageName));
  })
[ 'com.facebook.katana',
  'com.facebook.lite',
  'com.facebook.orca',
  'com.facebook.work',
  'com.facebook.stickered' ]

Do you know if Google have changed their API? I am pretty sure this was working fine a few months ago.

How to run this package to download app?

The guide of this package is "too clear" for me to use.
npm install gpapi --save
create index.js:

var api = require('gpapi').GooglePlayAPI({
username: "[email protected]",
password: "xxxxxxxxx",
androidId: "334340280EA00B10"
// apiUserAgent: optional API agent override (see below)
// downloadUserAgent: optional download agent override (see below)
});

// usage via Promise
api.details("com.viber.voip").then(console.log);

// usage via node callback convention
api.details("com.viber.voip", function (err, res) {
console.log(err ? err : res);
});

Then how???

Does not work, returns null values

Hello!
Your parser again stopped working.
Works only: App details
Do you plan to fix it?

➜  gp-download-info com.skype.raider | jq '.'
{ downloadSize: null,
  signature: null,
  downloadUrl: null,
  additionalFile: [],
  downloadAuthCookie: [],
  forwardLocked: null,
  refundTimeout: null,
  serverInitiated: null,
  postInstallRefundWindowMillis: null,
  immediateStartNeeded: null,
  patchData: null,
  encryptionParams: null,
  gzippedDownloadUrl: null,
  gzippedDownloadSize: null,
  splitDeliveryData: [],
  installLocation: null }

Thanks!

Error retrieving information from server. [DF-DFERH-01]

I get my apiUserAgent and downloadUserAgent by using package capture app.

But getting this error :

message:"Error retrieving information from server. [DF-DFERH-01]"
name:"RequestError"
statusCode:400

My config is like this :

var playapi = require('gpapi').GooglePlayAPI({
    username: '[email protected]',
    password: 'xxxxxxxx',
    androidId: '330xxE49xxxxxxx7',
    countryCode:'tr',
    language:'tr_TR',
    apiUserAgent: 'Android-Finsky/xxxxxxxxxxxxxxxxxxxxxxxxx (api=3,versionCode=xxxxxxx,sdk=19,device=t03g,hardware=xxxxx,product=xxxxxx,platformVersionRelease=4.4.2,model=xxxxxxx,buildId=xxxxxx,isWideScreen=0,supportedAbis=xxxxx-v7a;xxxxx)',
    downloadUserAgent: 'AndroidDownloadManager/4.4.2 (Linux; U; Android 4.4.2; GT-xxxxx Build/xxxx)',
});

And request is :

playapi.downloadInfo("com.opera.browser").then(
                  function (downloadResult, x, y, z, t) {
                      console.log(downloadResult)
                  }).catch(function (err) {
                  var a = 1;
              });

Unhandled rejection Error

Hello, i am install your module and its throw error after login.

api.details("com.viber.voip").then(console.log);

Unhandled rejection Error
at handleErr (node_modules/gpapi/lib/api.js:246:31)
at node_modules/gpapi/lib/api.js:251:18
at tryCatcher (node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (node_modules/bluebird/js/release/promise.js:509:35)

Whenever I call login I get

an assertion error "Expected list of pairs from server".

Digging in I see the assertion and it is when parsing a response containing:

SID=BAD_COOKIE
LSID=BAD_COOKIE
Auth=asdf
Token=oauth2asdf

Any thoughts?

Idea: Opt-in metrics collection for crowd-sourced detection of Play Store API breakage

Would anyone object to adding an optional feature that collects and reports back metrics from their gpapi usage.

Specifically I think it would benefit the community of users that currently aren't sure when Google changes the protocol and breaks usage of this API. By crowd sourcing data maybe we would know faster when everyone is having an issue using the API.

See e.g., #84 #83

Your input is welcome before I add something like this. Thanks!

Purchase and download App

I have a play store account with credit on it. How can I purchase an APK and download it?

Thanks,

Invalid Token

I'm getting invalid token error. How Use I script?
var api = require('gpapi').GooglePlayAPI({
username: [email protected],
password: @pass123,
androidId: EA65779211132
// apiUserAgent: optional API agent override (see below)
// downloadUserAgent: optional download agent override (see below)
});

completeDownloadInfo return AssertionError: require downloadUrl

Hi,

Api suddenly stopped working -

calling gpapi.GooglePlayAPI(gpAccount) to get the API
and then calling api.completeDownloadInfo(packageName,versionCode)
throws an error - AssertionError: require downloadUrl

chain of calls - completeDownloadInfo-> getCompleteDownloadInfo-> getDownloadInfo() - result return empty with no data, and then the following row:
assert(res.downloadUrl, 'require downloadUrl');
causing an error to be thrown

Did anyone else encountered the problem?
Can someone help?

Thanks

Google Play purchases are not supported in your country | Cannot read property 'length' of null | return null results

not working

errors on app id: com.symudolcreadigol.prosiectx

➜  gp-get-sha1 com.symudolcreadigol.prosiectx
RequestError: Google Play purchases are not supported in your country. Unfortunately you will not be able to complete purchases.

➜  gp-download-info com.symudolcreadigol.prosiectx
RequestError: Google Play purchases are not supported in your country. Unfortunately you will not be able to complete purchases.

➜  gp-download-meta com.symudolcreadigol.prosiectx
RequestError: Google Play purchases are not supported in your country. Unfortunately you will not be able to complete purchases.

errors on app id: com.facebook.katana

➜  gp-get-sha1 com.facebook.katana 
TypeError: Cannot read property 'length' of null

➜  gp-download-info com.facebook.katana
{"downloadSize":null,"signature":null,"downloadUrl":null,"additionalFile":[],"downloadAuthCookie":[],"forwardLocked":null,"refundTimeout":null,"serverInitiated":null,"postInstallRefundWindowMillis":null,"immediateStartNeeded":null,"patchData":null,"encryptionParams":null,"gzippedDownloadUrl":null,"gzippedDownloadSize":null,"splitDeliveryData":[],"installLocation":null}

➜  gp-download-meta com.facebook.katana 
TypeError: Cannot read property 'length' of null

working

gp-bulk-details - ok
gp-details - ok

Your device is not compatible with this item

Hi,

Thanks for the great project.

I keep getting (a lot of times) this error: "Your device is not compatible with this item".

example package: "com.fitnesskeeper.runkeeper.pro".

Thanks
Avi

decode availability restrictions properly

In [36]: ids
Out[36]:
[[0, 2131428078],
 [2, 2131428079],
 [8, 2131428085],
 [9, 2131428082],
 [9, 2131428083],
 [10, 2131428080],
 [11, 2131428081],
 [12, 2131428084]]
In [37]: for ccase, id in ids: zz = yy.get_id('com.android.vending', id); print ccase, hex(id), zz, yy.get_string('com.android.vending', zz[1])
0 0x7f0b02ee (u'string', u'availability_restriction_generic', 2131428078) [u'availability_restriction_generic', u"This item isn't available."]
2 0x7f0b02ef (u'string', u'availability_restriction_country', 2131428079) [u'availability_restriction_country', u"This item isn't available in your country."]
8 0x7f0b02f5 (u'string', u'availability_restriction_not_in_group', 2131428085) [u'availability_restriction_not_in_group', u"You're not in the targeted group for this item."]
9 0x7f0b02f2 (u'string', u'availability_restriction_hardware_app', 2131428082) [u'availability_restriction_hardware_app', u"Your device isn't compatible with this version."]
9 0x7f0b02f3 (u'string', u'availability_restriction_hardware', 2131428083) [u'availability_restriction_hardware', u"Your device isn't compatible with this item."]
10 0x7f0b02f0 (u'string', u'availability_restriction_carrier', 2131428080) [u'availability_restriction_carrier', u"This item isn't available on your carrier."]
11 0x7f0b02f1 (u'string', u'availability_restriction_country_or_carrier', 2131428081) [u'availability_restriction_country_or_carrier', u"This item isn't available in your country or on your carrier."]
12 0x7f0b02f4 (u'string', u'availability_restriction_search_level', 2131428084) [u'availability_restriction_search_level', u"Your content filtering level doesn't allow you to download this item."]

the first column is the case from the client:

public static int getAvailabilityRestrictionResourceId(Document document) {
        int restriction = document.getAvailabilityRestriction();
        int resourceId = 0x7F0B02EE;
        switch(restriction) {
            case 2: {
                resourceId = 0x7F0B02EF;
                break;
            }
            case 8: {
                resourceId = 0x7F0B02F5;
                break;
            }
            case 9: {
                if(document.getDocumentType() == 1) {
                    resourceId = 0x7F0B02F2;
                    goto label_3;
                }

                resourceId = 0x7F0B02F3;
                break;
            }
            case 10: {
                resourceId = 0x7F0B02F0;
                break;
            }
            case 11: {
                resourceId = 0x7F0B02F1;
                break;
            }
            case 12: {
                resourceId = 0x7F0B02F4;
                break;
            }
        }

    label_3:
        FinskyLog.d("Item is not available. Reason: " + restriction, new Object[0]);
        return resourceId;
    }

so use the case to match up the restriction enum value to the string.

Do not download protos after package install

It is very weird and not very standard to download files directly from github (a gist even!) after package installation. Furthermore, this breaks when installing using a local npm repository on a machine that doesn't have outbound internet access (like, say a CI machine).

Instead I suggest one of:

  • Vendoring in the contents in this repo.
  • Checking the defs into a repo and making it a submodule.
  • Creating a new package with just the defs and have this one mark it as a dependency.

Error retrieving information from server. [RH-02]

Hi, info about error:

gpapi: 4.3.2

code:

var playapi = require('gpapi').GooglePlayAPI({
"username": "[email protected]",
"password": "xxx",
"androidId": "Exxxxx",
"apiUserAgent": "Android-Finsky/8.7.10-all (api=3,versionCode=80871000,sdk=23,device=mp1s3gss,hardware=mp1s3gss,product=mp1s3gss_global_com,platformVersionRelease=6.0,model=LG-H542,buildId=MRA58K,isWideScreen=0,supportedAbis=armeabi-v7a;armeabi)",
"downloadUserAgent": "AndroidDownloadManager/6.0 (Linux; U; Android 6.0; LG-H542 Build/MRA58K)",
});

playapi.details("com.mobinavel.KeepTheBall", function (err, res) {
console.log(err ? err : res);
});

Error:
Error retrieving information from server. [RH-02]

Details:

Error
at handleErr (c:\Users\mobinavel\Documents\downloadTest\node_modules\gpapi\lib\api.js:237:31)
at c:\Users\mobinavel\Documents\downloadTest\node_modules\gpapi\lib\api.js:242:18
at tryCatcher (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:509:35)
at Promise._settlePromise (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:693:18)
at Promise._fulfill (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:638:18)
at PromiseArray._resolve (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise_array.js:126:19)
at PromiseArray._promiseFulfilled (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise_array.js:144:14)
at PromiseArray._iterate (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise_array.js:114:31)
at PromiseArray.init [as _init] (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise_array.js:78:10)
at Promise._settlePromise (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:566:21)
at Promise._settlePromise0 (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:693:18)
at Promise._fulfill (c:\Users\mobinavel\Documents\downloadTest\node_modules\bluebird\js\release\promise.js:638:18)"

i test details.test.js, but it doesn't work. error:

TAP version 13

details api

not ok 1 no error


operator: notOk
expected: |-
  false
actual: |-
  { actual: false, expected: true, generatedMessage: false, message: 'not application/x-gzip response', name: 'AssertionError', operator: '==' }
at: tryCatch1 (/home/work/linhai/node/node-googleplay/node_modules/bluebird/js/main/util.js:45:21)

...
not ok 2 returned results


operator: ok
expected: true
actual:   undefined
at: tryCatch1 (/home/work/linhai/node/node-googleplay/node_modules/bluebird/js/main/util.js:45:21)

...

1..2

tests 2

pass 0

fail 2

Cannot install in Windows

I ran npm install -g node-googleplay-api and I got the following:

> [email protected] postinstall C:\Users\Len\AppData\Roaming\npm\node_modules\node-googleplay-api
> npm run get-proto

> [email protected] get-proto C:\Users\Len\AppData\Roaming\npm\node_modules\node-googleplay-api
> scripts/get_latest_proto.js

'scripts' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! [email protected] get-proto: `scripts/get_latest_proto.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] get-proto script.
npm ERR! This is most likely a problem with the node-googleplay-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     scripts/get_latest_proto.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-googleplay-api
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\np
m-cli.js" "run" "get-proto"
npm ERR! cwd C:\Users\Len\AppData\Roaming\npm\node_modules\node-googleplay-api
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Len\AppData\Roaming\npm\node_modules\node-googleplay-api\npm-debug.log
npm ERR! not ok code 0

npm ERR! [email protected] postinstall: `npm run get-proto`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the node-googleplay-api package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run get-proto
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-googleplay-api
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "node-googleplay-api"
npm ERR! cwd C:\Users\Len\Desktop\area51\python-api
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Was it due to protobuf?

401 unauthorized error after multiple requests

Hello,

  1. I see 401 Unauthorized status code error after multiple requests (3 in my case).
    How do I avoid this error to make unlimited requests? Is there a way I can delay the requests by limiting few requests/minute?

exact error message:

message: '<HTML>\n<HEAD>\n<TITLE>Unauthorized</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Unauthorized</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', name: 'RequestError', statusCode: 401, headers: { 'content-type': 'text/html; charset=UTF-8', 'www-authenticate': 'GoogleLogin realm="https://accounts.google.com/ClientLogin", service="androidmarket"', date: 'Mon, 19 Mar 2018 01:07:35 GMT', expires: 'Mon, 19 Mar 2018 01:07:35 GMT', 'cache-control': 'private, max-age=0', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', server: 'GSE', 'alt-svc': 'hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="41,39,35"', 'accept-ranges': 'none', vary: 'Accept-Encoding', connection: 'close' } }

EDIT: By the way i am calling api.details and download and in my case i am making another request only after the APK file download & upload is completed 100% which will take approx. 4-5 min. Isn't 5min good amount of time for another request to the api?

  1. Is the pkg param case sensitive for api.details?

Thanks

can not download apk now.

i try call download.js failed, the node-google-play can not download apk from google play now.

delivery api need a param : "dtok".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.