mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-26 06:34:57 +00:00
_delivery_data returns more information
This commit is contained in:
parent
e05d126f6b
commit
0a13755ff9
@ -502,7 +502,11 @@ class GooglePlayAPI(object):
|
|||||||
cookies=cookies, verify=ssl_verify,
|
cookies=cookies, verify=ssl_verify,
|
||||||
stream=True, timeout=60,
|
stream=True, timeout=60,
|
||||||
proxies=self.proxies_config)
|
proxies=self.proxies_config)
|
||||||
return response.iter_content(chunk_size=(32 * 1 << 10))
|
total_size = response.headers.get('content-length')
|
||||||
|
chunk_size = 32 * (1 << 10)
|
||||||
|
return {'data': response.iter_content(chunk_size=chunk_size),
|
||||||
|
'total_size': total_size,
|
||||||
|
'chunk_size': chunk_size}
|
||||||
|
|
||||||
def delivery(self, packageName, versionCode=None, offerType=1,
|
def delivery(self, packageName, versionCode=None, offerType=1,
|
||||||
downloadToken=None, expansion_files=False):
|
downloadToken=None, expansion_files=False):
|
||||||
@ -557,7 +561,7 @@ class GooglePlayAPI(object):
|
|||||||
cookies = {
|
cookies = {
|
||||||
str(cookie.name): str(cookie.value)
|
str(cookie.name): str(cookie.value)
|
||||||
}
|
}
|
||||||
result['data'] = self._deliver_data(downloadUrl, cookies)
|
result['file'] = self._deliver_data(downloadUrl, cookies)
|
||||||
if not expansion_files:
|
if not expansion_files:
|
||||||
return result
|
return result
|
||||||
for obb in resObj.payload.deliveryResponse.appDeliveryData.additionalFile:
|
for obb in resObj.payload.deliveryResponse.appDeliveryData.additionalFile:
|
||||||
@ -570,7 +574,7 @@ class GooglePlayAPI(object):
|
|||||||
obbType = 'patch'
|
obbType = 'patch'
|
||||||
a['type'] = obbType
|
a['type'] = obbType
|
||||||
a['versionCode'] = obb.versionCode
|
a['versionCode'] = obb.versionCode
|
||||||
a['data'] = self._deliver_data(obb.downloadUrl, None)
|
a['file'] = self._deliver_data(obb.downloadUrl, None)
|
||||||
result['additionalData'].append(a)
|
result['additionalData'].append(a)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -8,20 +8,25 @@ ap.add_argument('-p', '--password', dest='password', help='google password')
|
|||||||
|
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
server = GooglePlayAPI(debug=True)
|
server = GooglePlayAPI(debug=True, locale='it_IT', timezone='Europe/Rome')
|
||||||
|
|
||||||
# LOGIN
|
# LOGIN
|
||||||
|
|
||||||
print('\nLogging in with email and password\n')
|
print('\nLogging in with email and password\n')
|
||||||
server.login(args.email, args.password, None, None)
|
server.login(args.email, args.password, None, None)
|
||||||
|
docid = 'com.pixel.gun3d'
|
||||||
|
|
||||||
download = server.download('com.mapswithme.maps.pro', 1754, progress_bar=True, expansion_files=True)
|
print('\nDownloading apk\n')
|
||||||
|
download = server.delivery(docid, versionCode=None, expansion_files=True)
|
||||||
with open(download['docId'] + '.apk', 'wb') as first:
|
with open(download['docId'] + '.apk', 'wb') as first:
|
||||||
first.write(download['data'])
|
for chunk in download.get('file').get('data'):
|
||||||
|
first.write(chunk)
|
||||||
|
|
||||||
|
print('\nDownloading additional files\n')
|
||||||
for obb in download['additionalData']:
|
for obb in download['additionalData']:
|
||||||
name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb'
|
name = obb['type'] + '.' + str(obb['versionCode']) + '.' + download['docId'] + '.obb'
|
||||||
with open(name, 'wb') as second:
|
with open(name, 'wb') as second:
|
||||||
second.write(obb['data'])
|
for chunk in obb.get('file').get('data'):
|
||||||
|
second.write(chunk)
|
||||||
|
|
||||||
print('\nDownload successful\n')
|
print('\nDownload successful\n')
|
||||||
|
2
test.py
2
test.py
@ -39,7 +39,7 @@ print('\nTelegram docid is: %s\n' % docid)
|
|||||||
print('\nAttempting to download %s\n' % docid)
|
print('\nAttempting to download %s\n' % docid)
|
||||||
fl = server.delivery(docid, versionCode=None)
|
fl = server.delivery(docid, versionCode=None)
|
||||||
with open(docid + '.apk', 'wb') as apk_file:
|
with open(docid + '.apk', 'wb') as apk_file:
|
||||||
for chunk in fl.get('data'):
|
for chunk in fl.get('file').get('data'):
|
||||||
apk_file.write(chunk)
|
apk_file.write(chunk)
|
||||||
print('\nDownload successful\n')
|
print('\nDownload successful\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user