Updated protobuf?
Hi @NoMore201, Is it possible to get the latest google protobuf and googleplay_pb2.py? It seems that a lot of fields have been added to the Play Store in the meantime, such as whether an app is (Unreleased) or not. I don't know what kind of work goes into this, but I'd be extremely grateful! Many thanks
+1
You can test changes in commit 46b4271 on branch next. Read the commit for a list of changes introduced. Also, I'll leave this issue open for any bug report regarding these changes
@NoMore201 Thanks for the big update! It's not immediately clear where "Unreleased" can be found for an app.
For example, if you take any of these apps https://play.google.com/store/apps/collection/promotion_early_access_APPLICATION?hl=en, like https://play.google.com/store/apps/details?id=com.rockspin.weaveapp&hl=en, you'll see the web and app Play Store adding (Unreleased) to the name. However, the API doesn't list this (and oddly, neither does the web Play Store when in incognito).
@NoMore201 thanks for the update. I found out that when 'earlyAccessInfo' is present then this indicates an unreleased app, so thanks for solving this for us with this update.
I am having another issue. You have the new parseProtobufObj() function which just outputs everything which is great. I want to turn the output into JSON so that I can parse it using PHP. For this, I need to use json.dumps(). Unfortunately, it keeps throwing a TypeError when it encounters the permissions. For some reason, these are not JSON serializable. Do you have a solution for this? This is not the case with the previous version, which converts to JSON perfectly.
TypeError: ['android.permission.ACCESS_NETWORK_STATE', 'android.permission.ACCESS_WIFI_STATE', 'android.permission.INTERNET', 'android.permission.REQUEST_INSTALL_PACKAGES', 'android.permission.WAKE_LOCK', 'com.google.android.c2dm.permission.RECEIVE', 'nl.rijksoverheid.mbb.pub.permission.C2D_MESSAGE'] is not JSON serializable
I'm guessing the list of permissions are not parsed properly?
@NoMore201 I fixed the issue myself. There was an issue with your parseProtobufObj() function, it was struggling with some of the protobuf repeated data structures such as "google.protobuf.pyext._message.RepeatedScalarContainer".
I fixed everything by replacing the entire parseProtobufObj(obj) function with just this:
from google.protobuf.json_format import MessageToDict
...
def parseProtobufObj(obj):
dict = MessageToDict(obj, False, False, False)
return dict
Turns out there is alread a built-in function that converts the protobuf output to dict, so you didn't need to write it yourself! And best of all for me, the output from this successfully encodes to json using json.dumps.
I'll let you decide whether you'll take my code suggestion. Unless you had another reason for doing it the way you did?
@SeBsZ thanks for pointing it out. I had a look at the protobuf docs and somehow missed the MessageToDict function, so I decided to parse it manually. This will help greatly