Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list nb_results and offset (fix) no longer work #142

Open
4knahs opened this issue Apr 1, 2021 · 1 comment
Open

list nb_results and offset (fix) no longer work #142

4knahs opened this issue Apr 1, 2021 · 1 comment

Comments

@4knahs
Copy link

4knahs commented Apr 1, 2021

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

@4knahs
Copy link
Author

4knahs commented Apr 1, 2021

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)
        ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant