NoMore201 / googleplay-api

Google Play Unofficial Python API
Other
409 stars 208 forks source link

gpapi.googleplay.RequestError: 'Too many results requested #110

Open bellalm opened 4 years ago

bellalm commented 4 years ago

whene i try to get list of app in the top new free categories i get this error

Traceback (most recent call last): File "C:/Users/bellal/Desktop/googleplay-api-master/test/test.py", line 127, in appList = server.list(cat, catList[0],200,150) File "C:\Users\bellal\Desktop\googleplay-api-master\gpapi\googleplay.py", line 452, in list data = self.executeRequestApi2(path) File "C:\Users\bellal\Desktop\googleplay-api-master\gpapi\googleplay.py", line 336, in executeRequestApi2 raise RequestError(message.commands.displayErrorMessage) gpapi.googleplay.RequestError: 'Too many results requested.'

appList = server.list("BOOKS_AND_REFERENCE", "apps_topselling_free",100)

rscmendes commented 4 years ago

The line of code appList = server.list("BOOKS_AND_REFERENCE", "apps_topselling_free",100) should work fine. You can list up to 100 apps for each list() request.

However, in your code you are requesting 200 according to that traceback: appList = server.list(cat, catList[0],200,150)

Just change the 200 to 100 and you should be fine.

bellalm commented 4 years ago

i test that but the same problem ...work fine only with first 100 result but after that give me this error "too many result" code # LIST cat = "BOOKS_AND_REFERENCE" print("\nList {} subcategories\n".format(cat)) catList = server.list(cat) for c in catList: print(c) limit=4 print("\nList only {} apps from subcat {} for {} category\n".format( limit, catList[1], cat)) appList = server.list(cat, catList[2], 200, 150) for app in appList: print(app["docid"]) traceback Traceback (most recent call last): File "C:/Users/bellal/Desktop/googleplay-api-master/test/test.py", line 135, in <module> appList = server.list(cat, catList[2], 200, 150) File "C:\Users\bellal\Desktop\googleplay-api-master\gpapi\googleplay.py", line 452, in list data = self.executeRequestApi2(path) File "C:\Users\bellal\Desktop\googleplay-api-master\gpapi\googleplay.py", line 336, in executeRequestApi2 raise RequestError(message.commands.displayErrorMessage) gpapi.googleplay.RequestError: 'Too many results requested.'

bellalm commented 4 years ago

the problem come from appList = server.list(cat, catList[0],200,150) the 4 argument he doesn't impact the result .

for example ``appList = server.list(cat, catList[0],10,5) .... that will return always 10 result No matter how you change 5

bellalm commented 4 years ago

the probleme exactly in the o=8 don't impact the result anyway https://android.clients.google.com/fdfe/list?c=3&cat=BOOKS_AND_REFERENCE&ctr=apps_movers_shakers&n=10&o=5

rscmendes commented 4 years ago

I think you misunderstood what I said. Just change appList = server.list(cat, catList[0],200,150) to appList = server.list(cat, catList[0],100,150) in your code and you should be fine.

the probleme exactly in the o=8 don't impact the result anyway https://android.clients.google.com/fdfe/list?c=3&cat=BOOKS_AND_REFERENCE&ctr=apps_movers_shakers&n=10&o=5

This is true. There was a PR that should fix this, but it had some problems (see PR #62 ). The main author hasn't made another PR to fix it, so I might try and do it. In the mean time, you can use the code from the PR that fixes it.

Edit: check #111.

bellalm commented 4 years ago

great now work fine ... i have another question can we determine country (to get list for specific country) and thank you sir

rscmendes commented 4 years ago

I personally couldn't get the proxy to work (maybe I did something wrong). What I did to change the country was to use a vpn.

bellalm commented 4 years ago

there is away to do it whithout proxy or vpn ? i found this function def getLoginParams(self, email, encrypted_passwd): return {"Email": email, "EncryptedPasswd": encrypted_passwd, "add_account": "1", "accountType": ACCOUNT, "google_play_services_version": self.device.get('gsf.version'), "has_permission": "1", "source": "android", "device_country": self.locale[0:2], "lang": self.locale, "client_sig": "38918a453d07199354f8b19af05ec6562ced5788", "callerSig": "38918a453d07199354f8b19af05ec6562ced5788"} in config.py wich there is "device_country": self.locale[0:2] this line can select country but i try to change it to different country but seems doesn't work