https://github.com/dweinstein/node-google-play
Get details and download apps from https://play.google.com by emulating an Android (Nexus 5X) device by default. For a rust version of this library check out https://github.com/dweinstein/rs-google-play
https://github.com/dweinstein/node-google-play
android apk download google metadata nodejs play-store
Last synced: 9 months ago
JSON representation
Get details and download apps from https://play.google.com by emulating an Android (Nexus 5X) device by default. For a rust version of this library check out https://github.com/dweinstein/rs-google-play
- Host: GitHub
- URL: https://github.com/dweinstein/node-google-play
- Owner: dweinstein
- License: mit
- Archived: true
- Created: 2014-10-28T18:40:02.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T19:05:41.000Z (over 4 years ago)
- Last Synced: 2024-04-24T03:23:07.956Z (over 1 year ago)
- Topics: android, apk, download, google, metadata, nodejs, play-store
- Language: JavaScript
- Homepage:
- Size: 529 KB
- Stars: 267
- Watchers: 29
- Forks: 84
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-tools - Google play crawler (Node) - get app details and download apps from official Google Play Store. (Android Security / Market Crawlers)
- fucking-android-security-awesome - Google Play crawler (Node) - get app details and download apps from the official Google Play Store. (Tools / Market Crawlers)
- android-security-awesome - Google Play crawler (Node) - get app details and download apps from the official Google Play Store. (Tools / Market Crawlers)
README
[](https://nodei.co/npm/gpapi/)
[](https://travis-ci.org/dweinstein/node-google-play)
[](https://www.npmjs.com/package/gpapi)
For a rust version of this library check out [rs-gpapi](https://github.com/dweinstein/rs-google-play).
# SYNOPSIS
Call Google Play APIs from Node. You might want to check out the [CLI](https://github.com/dweinstein/node-google-play-cli) package as well.
By default behaves like a Nexus device with SDK 23 for app downloads.
# USAGE
```javascript
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:
```js
{
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](https://play.google.com/store/apps/details?id=com.evozi.deviceid&hl=en)
**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](https://github.com/mitmproxy/mitmproxy) session:


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](https://github.com/request/request), therefore you can [control proxy behavior](https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables) 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](https://github.com/request/request-debug).
You can provide the debug option too.
```js
{
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
```javascript
± % 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.
Viber is compatible with and optimized for Android tablets! Use Viber on your tablet and phone simultaneously.
On Viber, your phone number is your ID. The app syncs with your mobile contact list, automatically detecting which of your contacts have Viber.
•\tText with your friends
•\tMake free calls with HD sound quality
•\tPhoto sharing, video messages, voice messages, locations, stickers and emoticons
•\tGroups with up to 100 participants
•\tDownload stickers from the Sticker Market, making messaging fun!
•\tAbility to sort and reorder stickers
•\tPush notifications guarantee that you never miss a message or call, even when Viber is off
•\tIntegration with native contact list for calls and messages
•\tSupport for the Viber Desktop application on Windows and Mac
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
Viber is completely free with no advertising.
We value your privacy.
Follow us for updates and news:
Facebook - http://facebook.com/viber
Twitter - http://twitter.com/viber
(*) Network data charges may apply",
"offer": [
{
"micros": "0",
"currencyCode": "USD",
"formattedAmount": "Free",
"checkoutFlowRequired": false,
"offerType": 1
}
],
...
```
## Related apps
```javascript
± % 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
```javascript
± % 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
```javascript
± % 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