Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

< Working > #69

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@

# ignore downloaded apps
*.apk

config.py
.DS_Store
Empty file added __init__.py
Empty file.
File renamed without changes.
8 changes: 5 additions & 3 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# Download
print "Downloading %s..." % sizeof_fmt(doc.details.appDetails.installationSize),
data = api.download(packagename, vc, ot)
open(filename, "wb").write(data)
print "Done"

if data:
open(filename, "wb").write(data)
print "Done"
else:
print "Error"
23 changes: 17 additions & 6 deletions googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def login(self, email=None, password=None, authSubToken=None):
params = {}
for d in data:
if not "=" in d: continue
k, v = d.split("=")
v_len = d.find('=') + 1
k = d.split("=")[0]
v = d[v_len:]
params[k.strip().lower()] = v.strip()
if "auth" in params:
self.setAuthSubToken(params["auth"])
Expand Down Expand Up @@ -219,10 +221,11 @@ def browse(self, cat=None, ctr=None):
path += "&cat=%s" % requests.utils.quote(cat)
if (ctr != None):
path += "&ctr=%s" % requests.utils.quote(ctr)

message = self.executeRequestApi2(path)
return message.payload.browseResponse

def list(self, cat, ctr=None, nb_results=None, offset=None):
def list(self, cat, ctr=None, nb_results=None, offset=None, ctntkn=None):
"""List apps.

If ctr (subcategory ID) is None, returns a list of valid subcategories.
Expand All @@ -232,9 +235,12 @@ def list(self, cat, ctr=None, nb_results=None, offset=None):
if (ctr != None):
path += "&ctr=%s" % requests.utils.quote(ctr)
if (nb_results != None):
path += "&n=%s" % requests.utils.quote(nb_results)
path += "&n=%s" % int(nb_results)
if (offset != None):
path += "&o=%s" % requests.utils.quote(offset)
path += "&o=%s" % int(offset)
if (ctntkn != None):
path += "&ctntkn=%s" % requests.utils.quote(ctntkn)

message = self.executeRequestApi2(path)
return message.payload.listResponse

Expand Down Expand Up @@ -264,8 +270,13 @@ def download(self, packageName, versionCode, offerType=1):
message = self.executeRequestApi2(path, data)

url = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadUrl
cookie = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadAuthCookie[0]

cookie = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadAuthCookie

if len(cookie) > 0:
cookie = cookie[0]
else:
return False

cookies = {
str(cookie.name): str(cookie.value) # python-requests #459 fixes this
}
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
protobuf==3.0.0
requests==2.10.0
six==1.10.0
wheel==0.24.0