from gpapi.googleplay import GooglePlayAPI import sys EMAIL = "maracaiboez" PASSWD = "fjgozwjmkwyvvutt" testApps = ['com.cpuid.cpu_z'] server = GooglePlayAPI(debug=True) # LOGIN print('\nLogging in with email and password\n') server.login(EMAIL, PASSWD, None, None) gsfId = server.gsfId authSubToken = server.authSubToken print('\nNow trying secondary login with ac2dm token and gsfId saved\n') server = GooglePlayAPI(debug=True) server.login(None, None, gsfId, authSubToken) # SEARCH apps = server.search('termux', 34, None) print('nb_result: 34') print('number of results: %d' % len(apps)) print('\nFound those apps:\n') for a in apps: print(a['docId']) # DOWNLOAD docid = apps[0]['docId'] version = apps[0]['versionCode'] print('\nTermux docid is: %s\n' % docid) print('\nAttempting to download %s\n' % docid) fl = server.download(docid, version) with open(docid + '.apk', 'wb') as f: f.write(fl) print('\nDownload successful\n') f.close() # BULK DETAILS print('\nGetting details for %s\n' % testApps[0]) bulk = server.bulkDetails(testApps) print(bulk) # BROWSE print('\nBrowse play store categories\n') browse = server.browse() for b in browse: print(b['name']) print('\nBrowsing the %s category\n' % browse[0]['catId']) browseCat = server.browse(browse[0]['catId']) for b in browseCat: print('%s subcategory with %d apps' % (b['title'],len(b['apps']))) # LIST cat = 'MUSIC_AND_AUDIO' print('\nList %s subcategories\n' % cat) catList = server.list(cat) for c in catList: print(c) print('\nList %s apps for %s category\n' % (catList[0],cat)) appList = server.list(cat, catList[0]) for app in appList: print(app['docId'])