English | 繁體中文
Access Google Play by logging in and making requests as an Android device!
A version of this library for PHP is being developed.
Please report any bugs you discover at https://github.com/GoneToneStudio/node-google-play-api/issues
Node.js 14.0.0 or newer is required.
npm install @gonetone/google-play-api
-
Navigate to https://accounts.google.com/EmbeddedSetup
-
Sign in with your Google account
-
Select "I agree"
-
Navigate to "Cookie"
-
Expand accounts.google.com > Cookie, find "oauth_token", and select the value beginning with
oauth2_4/
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:
- The device which you get the GSF ID from will affect the subsequent data of the application. If the application which you want to get data from doesn’t support the device you get the GSF ID from, the data will return null. Thus, make sure whether the application supports your device.
- Android TV cannot download the "Device ID" APP directly from Google Play. Nevertheless, you can download it on other devices and backup as .APK file, then, transfer the .APK file to Android TV to complete your installation.
const { GooglePlayAPI } = require('@gonetone/google-play-api')
const gpAPI = new GooglePlayAPI("[email protected]", "The GSF ID (Google Service Framework ID) of your device")
gpAPI.setUserAgent('User-Agent')
gpAPI.setClientID('am-android-asus')
gpAPI.setSdkVersion(28)
gpAPI.setCountryCode('tw')
gpAPI.setLanguageCode('zh-TW')
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)
})
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)
})
gpAPI.getGoogleToken('Your OAuth2 Token', 'save/token.txt').then(async (token) => {
await gpAPI.googleAuth(token)
const search = await gpAPI.search('GitHub')
console.log(search)
})
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)
})
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)
})
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
})
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)
})
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)
})
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:
- You can use Split APKs Installer (SAI) this app to install split apks.
- Don’t forget to use
gpAPI.downloadApk()
to download the main apk, then install together.
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)
})
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)
})
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
})