Last active
May 28, 2020 11:33
-
-
Save sn0opy/306fdfb60b1e00e6b3fc0d5c95dafa81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install gpapi | |
import requests | |
from apkutils import APK | |
from gpapi.googleplay import GooglePlayAPI | |
host = "https://matlink.fr/token" | |
package = "com.nianticlabs.pokemongo" | |
version = None | |
reqemail = requests.get("{}/email".format(host)) | |
email = reqemail.text | |
print("Got random email address") | |
reqtoken = requests.get("{}/token/email/{}".format(host, email)) | |
token = reqtoken.text | |
print("Got token") | |
api = GooglePlayAPI(locale="en_US", timezone="UTC", device_codename="hero2lte") | |
gsfid = api.checkin(email, token) | |
print("Got device id") | |
api.login(gsfId=int(gsfid), authSubToken=token) | |
details = api.details(package) | |
appdetails = details["details"]["appDetails"] | |
print( | |
"versionCode={}, versionString={}, splits={}, unstable={}".format( | |
appdetails["versionCode"], | |
appdetails["versionString"], | |
len(appdetails["file"]), | |
appdetails["unstable"], | |
) | |
) | |
dl = api.download(package, versionCode=appdetails["versionCode"] if version is None else version) | |
print("Writing base.apk") | |
with open("base.apk", "wb") as fb: | |
for index, chunk in enumerate(dl["file"]["data"]): | |
fb.write(chunk) | |
for file in dl["splits"]: | |
print("Writing {}.apk".format(file["name"])) | |
with open("{}.apk".format(file["name"]), "wb") as fb: | |
for index, chunk in enumerate(file["file"]["data"]): | |
fb.write(chunk) | |
apk = APK("base.apk") | |
apkversion = apk.get_manifest()["@android:versionName"] | |
print("Downloaded version {}".format(apkversion)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment