2017-10-17 15:58:24 +00:00
|
|
|
from gpapi.googleplay import GooglePlayAPI
|
2017-10-17 09:41:39 +00:00
|
|
|
|
2017-10-17 15:58:24 +00:00
|
|
|
import argparse
|
2017-10-17 09:41:39 +00:00
|
|
|
|
2017-10-17 15:58:24 +00:00
|
|
|
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()
|
2017-10-17 09:41:39 +00:00
|
|
|
|
2018-02-03 13:30:21 +00:00
|
|
|
server = GooglePlayAPI('it_IT', 'Europe/Rome')
|
2017-10-17 09:41:39 +00:00
|
|
|
|
|
|
|
# LOGIN
|
|
|
|
|
|
|
|
print('\nLogging in with email and password\n')
|
2017-10-17 15:58:24 +00:00
|
|
|
server.login(args.email, args.password, None, None)
|
2018-01-27 17:39:40 +00:00
|
|
|
docid = 'com.pixel.gun3d'
|
2017-10-17 09:41:39 +00:00
|
|
|
|
2018-01-27 17:39:40 +00:00
|
|
|
print('\nDownloading apk\n')
|
2018-02-01 10:53:16 +00:00
|
|
|
download = server.download(docid, expansion_files=True)
|
2017-10-17 09:41:39 +00:00
|
|
|
with open(download['docId'] + '.apk', 'wb') as first:
|
2018-01-27 17:39:40 +00:00
|
|
|
for chunk in download.get('file').get('data'):
|
|
|
|
first.write(chunk)
|
2017-10-17 09:41:39 +00:00
|
|
|
|
2018-01-27 17:39:40 +00:00
|
|
|
print('\nDownloading additional files\n')
|
2017-10-17 09:41:39 +00:00
|
|
|
for obb in download['additionalData']:
|
|
|
|
name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb'
|
|
|
|
with open(name, 'wb') as second:
|
2018-01-27 17:39:40 +00:00
|
|
|
for chunk in obb.get('file').get('data'):
|
|
|
|
second.write(chunk)
|
2017-10-17 15:58:24 +00:00
|
|
|
|
|
|
|
print('\nDownload successful\n')
|