forked from NoMore201/googleplay-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obb_download_test.py
27 lines (18 loc) · 881 Bytes
/
obb_download_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
# LOGIN
print('\nLogging in with email and password\n')
server.login(args.email, args.password, None, None)
download = server.download('com.mapswithme.maps.pro', 1754, progress_bar=True, expansion_files=True)
with open(download['docId'] + '.apk', 'wb') as first:
first.write(download['data'])
for obb in download['additionalData']:
name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb'
with open(name, 'wb') as second:
second.write(obb['data'])
print('\nDownload successful\n')