mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-10-18 06:50:45 +00:00
d984a92dc7
This function is needed by the purchase API to insert app into user's library. Without this, new apps won't be downloaded
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from gpapi.googleplay import GooglePlayAPI
|
|
|
|
import argparse
|
|
|
|
ap = argparse.ArgumentParser(description='Test download of expansion files')
|
|
ap.add_argument('-e', '--email', dest='email', help='google username')
|
|
ap.add_argument('-p', '--password', dest='password', help='google password')
|
|
|
|
args = ap.parse_args()
|
|
|
|
server = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
|
|
|
|
# LOGIN
|
|
|
|
print('\nLogging in with email and password\n')
|
|
server.login(args.email, args.password, None, None)
|
|
docid = 'com.pixel.gun3d'
|
|
|
|
print('\nDownloading apk\n')
|
|
download = server.download(docid, expansion_files=True)
|
|
with open(download['docId'] + '.apk', 'wb') as first:
|
|
for chunk in download.get('file').get('data'):
|
|
first.write(chunk)
|
|
|
|
print('\nDownloading additional files\n')
|
|
for obb in download['additionalData']:
|
|
name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb'
|
|
with open(name, 'wb') as second:
|
|
for chunk in obb.get('file').get('data'):
|
|
second.write(chunk)
|
|
|
|
print('\nDownload successful\n')
|