You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importreimportioimportclickfromgpapidl.googleplayimportGooglePlayAPIfromdotenvimportdotenv_valuesdictfilter=lambdafun, _dict: dict(filter(lambdax: fun(x[1]) iffunelsex[1], _dict.items()))
dictfilterkey=lambdafun, _dict: dict(filter(lambdax: fun(x[0]) iffunelsex[0], _dict.items()))
dictmap=lambdafun, _dict: dict(map(lambdax: (x[0], fun(x[1])), _dict.items()))
dictmapkey=lambdafun, _dict: dict(map(lambdax: (fun(x[0]), x[1]), _dict.items()))
defsizeof_fmt(num):
num=float(num)
forxin ['bytes','KB','MB','GB','TB']:
ifnum<1024.0:
return"%3.1f%s"% (num, x)
num/=1024.0defdownload_package(packagename_or_url, output=None, country="us"):
""" download a package from the Google Play Store """# Parse argumentsifre.fullmatch(r"([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*", packagename_or_url):
packagename=packagename_or_urlelifre.match(r".*\?id=([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*", packagename_or_url):
packagename=re.match(r".*\?id=(([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*)", packagename_or_url)[1]
else:
exit("Wrong APPID or URL.")
ifcountrynotinCOUNTRY_CODES.keys():
exit("Wrong country code.")
# Read config from .envconfig=dictmap(lambdav: vorNone, dotenv_values(".env"))
proxies_config=dictfilterkey(lambdak: kin ["HTTP_PROXY", "HTTPS_PROXY"], dictfilter(None, config))
proxies_config=dictmapkey(lambdak: k.lower(), proxies_config)
# Connect to Google Play Storeapi=GooglePlayAPI(locale=config['LOCALE'], device_codename="shamu", proxies_config=proxies_config)
api.login(config['GOOGLE_LOGIN'], config['GOOGLE_PASSWORD'], config['GOOGLE_AUTH_TOKEN'])
# Get the version code and the offer type from the app detailsm=api.details(packagename)
vc=m["details"]["appDetails"]["versionCode"]
ot=m["offer"][0]["offerType"]
ifoutput==None:
output=f"{packagename}_{vc}.apk"# Downloadprint("Downloading to file %s with size %s..."% (output, sizeof_fmt(m["details"]["appDetails"]["installationSize"])))
data=api.download(output, vc, ot)
io.open(output, "wb").write(data)
print("Done")
x@192-168-10-195 ******* % python -m ******* gp download com.smartprojects.MemoryLocker
Downloading to file com.smartprojects.MemoryLocker_35.apk with size 2.7MB...
[!] RequestError: Error retrieving information from server. DF-DFERH-01
x@192-168-10-195 ******* % python -m ******* gp download com.smartprojects.MemoryLocker --trace
Downloading to file com.smartprojects.MemoryLocker_35.apk with size 2.7MB...
Traceback (most recent call last):
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/x/Downloads/Projects/*******/*******/__main__.py", line 35, in <module>
cli()
File "/Users/x/Downloads/Projects/*******/*******/__main__.py", line 23, in cli
cli_commands()
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/Users/x/Downloads/Projects/*******/*******/cli/gp.py", line 207, in download
download_package(**kwargs)
File "/Users/x/Downloads/Projects/*******/*******/cli/gp.py", line 114, in download_package
data = api.download(output, vc, ot)
File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/gpapidl/googleplay.py", line 625, in download
raise RequestError(response.commands.displayErrorMessage)
gpapidl.googleplay.RequestError: 'Error retrieving information from server. DF-DFERH-01'
The text was updated successfully, but these errors were encountered:
Thx, I know that you develop this nice tool. But I need a python library. I already found one that's working, it was hard because github is a big dumpster.
The text was updated successfully, but these errors were encountered: