egirault / googleplay-api

Google Play Unofficial Python API - This project was a PoC and is not maintained anymore. Please feel free to fork it and improve it in any way.
878 stars 374 forks source link

Unexpected end-group tag #43

Open RankoR opened 9 years ago

RankoR commented 9 years ago

I'm getting the following error when I call any script with different (right) parameters:

File "search.py", line 33, in message = api.search(request, nb_res, offset) File "/Users/rankor/src/3rd-party/python/googleplay-api/googleplay.py", line 190, in search message = self.executeRequestApi2(path) File "/Users/rankor/src/3rd-party/python/googleplay-api/googleplay.py", line 171, in executeRequestApi2 message = googleplay_pb2.ResponseWrapper.FromString(data) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 583, in FromString message.MergeFromString(s) File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 844, in MergeFromString raise message_mod.DecodeError('Unexpected end-group tag.') google.protobuf.message.DecodeError: Unexpected end-group tag.

kku1993 commented 9 years ago

Have you tried running the script with the same parameter a couple of times or on a different machine? I found that the error usually goes away if I retry line 171 in googleplay.py.

aress31 commented 9 years ago

I got the exact same error it is really annoying I have spent weeks on it and couldn't figure out where it comes from! If anyone has a solution please share it!

ryanhubbell commented 9 years ago

I'm also seeing this issue now. In the past, just running the script once or twice more would fix the issue, but now I'm seeing this issue on every run, no matter if it's permissions, download, whatever.

EDIT: It seems that I'm getting a status code of 503 on the return, which the script does not check for, hence the Exception that happens, documented by the OP.

EDIT2: So it seems it's google blocking me. While this isn't necessarily a bug with this project, I think it should fail a little more gracefully than it does currently.

auagombe commented 9 years ago

@ryanidev, pls are you able to make the download. I am having same problem here. Thanks

ryanhubbell commented 9 years ago

Once in a while, yes. The problem is, Google will block you if you're hitting their servers too often (like running this project in a script to scrape the play store). You'll have to make sure to add in something to your project to make sure you're not hitting google too quickly (like I was, which caused the 503 errors I posted above).

auagombe commented 9 years ago

@ryanidev thanks for responding. This is the exact error I am getting: python download.py com.google.android.gm /Library/Python/2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning /Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning) Traceback (most recent call last): File "download.py", line 31, in m = api.details(packagename) File "/Users/aisha/googleplay-api/googleplay.py", line 197, in details message = self.executeRequestApi2(path) File "/Users/aisha/googleplay-api/googleplay.py", line 171, in executeRequestApi2 message = googleplay_pb2.ResponseWrapper.FromString(data) File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 583, in FromString message.MergeFromString(s) File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 844, in MergeFromString raise message_mod.DecodeError('Unexpected end-group tag.') google.protobuf.message.DecodeError: Unexpected end-group tag.

My thought is probably google is blocking the 'unofficial market api'.

ryanhubbell commented 9 years ago

I doubt that. It's just an HTML call. To see what google is actually returning, put this in googleplay.py at line 173: print data

This will print whatever Google returns from the Http call to the console.

Either the auth isn't hooked up properly, or Google is throttling you. I know the api works, I'm still using it (I was running a crawler before, and hitting Google pretty hard, hence getting blocked).

auagombe commented 9 years ago

Thanks for reply @ryanidev. I figure out the error is due to my Auth Code. When I use None for it I dont get same error. However I ended up with: Downloading 2.9MB... ;9Error retrieving information from server. [RPC:S-7:AEC-0]* Traceback (most recent call last): File "download.py", line 38, in data = api.download(packagename, vc, ot) File "/Users/aisha/googleplay-api/googleplay.py", line 267, in download cookie = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadAuthCookie[0] File "/Library/Python/2.7/site-packages/google/protobuf/internal/containers.py", line 64, in getitem return self._values[key] IndexError: list index out of range

I got this error only with the download.py. I have checked the package name (com.google.android.maps.mytracks) with search.py and permission.py and its correct

auagombe commented 9 years ago

@ryanidev I got it working finally, all the error were from my authentication; Authentication code and device ID that was tied to a different gmail account i used on google play. Thanks for your response.

prajitdas commented 9 years ago

Does anyone know how we can obtain a subAuth token? I think that is the reason we are getting these errors.