GoneToneStudio / node-google-play-api

Access Google Play by logging in and making requests as an Android device!
https://www.npmjs.com/package/@gonetone/google-play-api
MIT License
36 stars 9 forks source link

Google Play API (Node.js Library)

English | 繁體中文

Access Google Play by logging in and making requests as an Android device!

A version of this library for PHP is being developed.

Report Issues

Please report any bugs you discover at https://github.com/GoneToneStudio/node-google-play-api/issues

Installation

Node.js 14.0.0 or newer is required.

With NPM

npm install @gonetone/google-play-api

Obtain an OAuth2 Token

Obtain the GSF ID of your device (Google Service Framework ID)

You can install the "Device ID" APP on Google Play to obtain the GSF ID of your device: https://play.google.com/store/apps/details?id=tw.reh.deviceid

Please note:

Examples

const { GooglePlayAPI } = require('@gonetone/google-play-api')

Using GooglePlayAPI

const gpAPI = new GooglePlayAPI("Your_Google_Account@gmail.com", "The GSF ID (Google Service Framework ID) of your device")

Configuring User-Agent (Optional)

gpAPI.setUserAgent('User-Agent')

Configuring Client ID (Optional)

gpAPI.setClientID('am-android-asus')

Configuring SDK Version (Optional)

gpAPI.setSdkVersion(28)

Configuring Country Code (Optional)

gpAPI.setCountryCode('tw')

Configuring Language Code (Optional)

gpAPI.setLanguageCode('zh-TW')

Get App Details

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const details = await gpAPI.appDetails('com.github.android')

  console.log(`Title: ${details.title}`)
  console.log(`Description Html: ${details.descriptionHtml}`)
  console.log(`Developer Name: ${details.details.appDetails.developerName}`)
  console.log(`Version Code: ${details.details.appDetails.versionCode}`)
  console.log(`Version String: ${details.details.appDetails.versionString}`)
  console.log(`Package Name: ${details.details.appDetails.packageName}`)
  console.log(`Share Url: ${details.shareUrl}`)

  console.log(details)
})

Get Bulk Details

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const bulkDetails = await gpAPI.bulkDetails('com.github.android', 'com.twitter.android', 'com.facebook.katana')
  console.log(bulkDetails)
})

App Search

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const search = await gpAPI.search('GitHub')
  console.log(search)
})

Get Download Info

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const downloadInfo = await gpAPI.downloadInfo('com.github.android')
  //const downloadInfo = await gpAPI.downloadInfo('com.github.android', 613) // Specify Version Code

  console.log(downloadInfo)
})

Get Download Apk Url

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const downloadApkUrl = await gpAPI.downloadApkUrl('com.github.android')
  //const downloadApkUrl = await gpAPI.downloadApkUrl('com.github.android', 613) // Specify Version Code

  console.log(downloadApkUrl)
})

Download Apk

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  await gpAPI.downloadApk('com.github.android', 'save_folder')
  //await gpAPI.downloadApk('com.github.android', 'save_folder', 613) // Specify Version Code
})

Get Split Delivery Data Info

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const splitDeliveryDataInfo = await gpAPI.splitDeliveryDataInfo('com.supercell.clashofclans')
  //const splitDeliveryDataInfo = await gpAPI.splitDeliveryDataInfo('com.supercell.clashofclans', 1383) // Specify Version Code

  console.log(splitDeliveryDataInfo)
})

Get Download Split Apks Name And Url

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const downloadSplitApksNameAndUrl = await gpAPI.downloadSplitApksNameAndUrl('com.supercell.clashofclans')
  //const downloadSplitApksNameAndUrl = await gpAPI.downloadSplitApksNameAndUrl('com.supercell.clashofclans', 1383) // Specify Version Code

  console.log(downloadSplitApksNameAndUrl)
})

Download Split Apks

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  await gpAPI.downloadSplitApks('com.supercell.clashofclans', 'save_folder')
  //await gpAPI.downloadSplitApks('com.supercell.clashofclans', 'save_folder', 1383) // Specify Version Code
})

PS:

Get Additional File Info

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const additionalFileInfo = await gpAPI.additionalFileInfo('com.github.android')
  //const additionalFileInfo = await gpAPI.additionalFileInfo('com.github.android', 613) // Specify Version Code

  console.log(additionalFileInfo)
})

Get Download Additional File Urls

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  const downloadAdditionalFileUrls = await gpAPI.downloadAdditionalFileUrls('com.github.android')
  //const downloadAdditionalFileUrls = await gpAPI.downloadAdditionalFileUrls('com.github.android', 613) // Specify Version Code

  console.log(downloadAdditionalFileUrls)
})

Download Additional Files

gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
  await gpAPI.googleAuth(token)

  await gpAPI.downloadAdditionalFiles('com.github.android', 'save_folder')
  //await gpAPI.downloadAdditionalFiles('com.github.android', 'save_folder', 613) // Specify Version Code
})

License

MIT