googleplay-api
googleplay-api copied to clipboard
list nb_results and offset (fix) no longer work
The nb_results parameter (n in the google API) for setting the number of docs to be returned by the list request no longer seems to work. It always returns 7 apps.
The offset functionality is also broken, including the fix #111 .
The n parameter seems to not be working for getCluster anymore as well:
# i removed part of the hash for brevity
> data2 = self.executeRequestApi2(FDFE + 'getCluster?enpt=Cgj6...04&n=20')
> len(data2.payload.listResponse.doc[0].child[0].child)
7
If anyone comes with a fix for retrieving more than 7 apps at once please share.
Thanks
I am using the following workaround for the offset issue :
# Add this to googleplay.py
def cluster_list(self, cat, ctr, next_cluster=None):
path = LIST_URL + "?c=3&cat={}".format(requests.utils.quote(cat))
addons = "&ctr={}".format(requests.utils.quote(ctr))
if next_cluster is None:
data = self.executeRequestApi2(path + addons)
else:
data = self.executeRequestApi2(FDFE + next_cluster + addons)
apps = []
for d in data.payload.listResponse.doc: # categories
if len(d.child) > 1:
print('WARNING: Unexpected number of sub-categories')
for c in d.child: # sub-category
for a in c.child: # app
apps.append(utils.parseProtobufObj(a))
next_cluster = data.payload.listResponse.doc[0].child[0].containerMetadata.nextPageUrl
return apps, next_cluster
# In your code
total = 0
next_list = None
while total < apps_to_download:
app_list, next_list = gpapi.cluster_list('FAMILY', 'apps_topselling_free', amount, next_list)
...