mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 12:54:58 +00:00
Bool flag to control expansion files + cleanup
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
parent
b3f28cb0c4
commit
6857b15d45
@ -7,7 +7,6 @@ from Crypto.Hash import SHA
|
|||||||
from Crypto.Cipher import PKCS1_OAEP
|
from Crypto.Cipher import PKCS1_OAEP
|
||||||
from clint.textui import progress
|
from clint.textui import progress
|
||||||
|
|
||||||
from os.path import splitext
|
|
||||||
import requests
|
import requests
|
||||||
import base64
|
import base64
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
@ -446,8 +445,8 @@ class GooglePlayAPI(object):
|
|||||||
bar.done()
|
bar.done()
|
||||||
return response_content
|
return response_content
|
||||||
|
|
||||||
def delivery(self, packageName, versionCode,
|
def delivery(self, packageName, versionCode, offerType=1,
|
||||||
offerType=1, downloadToken=None, progress_bar=False):
|
downloadToken=None, progress_bar=False, expansion_files=False):
|
||||||
"""Download an already purchased app.
|
"""Download an already purchased app.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -493,9 +492,12 @@ class GooglePlayAPI(object):
|
|||||||
str(cookie.name): str(cookie.value)
|
str(cookie.name): str(cookie.value)
|
||||||
}
|
}
|
||||||
result['data'] = self._deliver_data(downloadUrl, cookies, progress_bar)
|
result['data'] = self._deliver_data(downloadUrl, cookies, progress_bar)
|
||||||
count = 1
|
if not expansion_files:
|
||||||
|
return result
|
||||||
for obb in resObj.payload.deliveryResponse.appDeliveryData.additionalFile:
|
for obb in resObj.payload.deliveryResponse.appDeliveryData.additionalFile:
|
||||||
a = {}
|
a = {}
|
||||||
|
# fileType == 0 -> main
|
||||||
|
# fileType == 1 -> patch
|
||||||
if obb.fileType == 0:
|
if obb.fileType == 0:
|
||||||
obbType = 'main'
|
obbType = 'main'
|
||||||
else:
|
else:
|
||||||
@ -506,9 +508,8 @@ class GooglePlayAPI(object):
|
|||||||
result['additionalData'].append(a)
|
result['additionalData'].append(a)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def download(self, packageName, versionCode, offerType=1,
|
||||||
def download(self, packageName, versionCode,
|
progress_bar=False, expansion_files=False):
|
||||||
offerType=1, progress_bar=False):
|
|
||||||
"""Download an app and return its raw data (APK file). Free apps need
|
"""Download an app and return its raw data (APK file). Free apps need
|
||||||
to be "purchased" first, in order to retrieve the download cookie.
|
to be "purchased" first, in order to retrieve the download cookie.
|
||||||
If you want to download an already purchased app, use *delivery* method.
|
If you want to download an already purchased app, use *delivery* method.
|
||||||
@ -544,8 +545,8 @@ class GooglePlayAPI(object):
|
|||||||
raise RequestError(resObj.commands.displayErrorMessage)
|
raise RequestError(resObj.commands.displayErrorMessage)
|
||||||
else:
|
else:
|
||||||
dlToken = resObj.payload.buyResponse.downloadToken
|
dlToken = resObj.payload.buyResponse.downloadToken
|
||||||
return self.delivery(packageName, versionCode,
|
return self.delivery(packageName, versionCode, offerType, dlToken,
|
||||||
offerType, dlToken, progress_bar=progress_bar)
|
progress_bar=progress_bar, expansion_files=expansion_files)
|
||||||
|
|
||||||
def changeDevice(self, device_codename):
|
def changeDevice(self, device_codename):
|
||||||
self.deviceBuilder = config.DeviceBuilder(device_codename)
|
self.deviceBuilder = config.DeviceBuilder(device_codename)
|
||||||
|
Loading…
Reference in New Issue
Block a user