googleplay-api
googleplay-api copied to clipboard
Unable to continue search on next page
Hi,
When using api.search(), the last child has a relatedLinks item that contains a
nextPageUrl element with a link.
However, the api does not offer any way (that I know of) to follow this link.
Am I missing something ? Can something like that be implemented in googleplay-api ?
It seems that calling
self.executeRequestApi2(FDFE + nextPageUrl) indeed gives some more results
This bit of code will collect all the apps and allow you continue on to the next page
from gpapi.googleplay import GooglePlayAPI
from gpapi import googleplay as gp
from gpapi import utils
api = GooglePlayAPI(...)
apps = []
result = api.search(<query>) #whatever the search query is
while result:
for doc in result:
if 'docid' in doc:
sub_res.append(doc["docid"])
for cluster in doc["child"]:
for app in cluster["child"]:
apps.append(app)
if 'containerMetadata' in cluster and 'nextPageUrl' in cluster["containerMetadata"]:
nextPageUrl = cluster["containerMetadata"]['nextPageUrl']
response = api.executeRequestApi2(gp.FDFE + nextPageUrl)
next_result = list(map(utils.parseProtobufObj,response.payload.listResponse.doc))
else:
next_result = None
result = next_result
for app in apps:
print(apps["backendDocid'])
If I have time, I'll create a pull request for an option to get all the results in search()