Skip to content

Commit

Permalink
Deploy deta.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub30 committed Sep 7, 2022
1 parent db1c7ff commit d489f3e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 51 deletions.
1 change: 1 addition & 0 deletions .deta/prog_info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"69e16597-fdbc-4183-bc0d-3a0ea8cdb96e","space":30303,"runtime":"python3.9","name":"apk","path":"gltc5n","project":"c0jh16my","account":"144798365827","region":"ap-southeast-1","deps":["altgraph==0.17","cachetools==4.1.1","certifi==2020.6.20","cffi==1.14.3","chardet==3.0.4","cryptography==3.1.1","future==0.18.2","google-api-core==1.22.4","google-api-python-client==1.12.3","google-auth==1.22.1","google-auth-httplib2==0.0.4","googleapis-common-protos==1.52.0","httplib2==0.18.1","idna==2.10","pefile==2019.4.18","protobuf==3.20.0","pyasn1==0.4.8","pyasn1-modules==0.2.8","pycparser==2.20","pyinstaller==4.9","pyinstaller-hooks-contrib==2020.9","pytz==2020.1","pywin32-ctypes==0.2.0","requests==2.24.0","rsa==4.6","six==1.15.0","uritemplate==3.0.1","urllib3==1.25.10","flask"],"envs":["email","password"],"public":true,"log_level":"debug","cron":""}
1 change: 1 addition & 0 deletions .deta/state
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"LICENSE.md":"59ce60118dcbf34f3a4b7bfd96d493fd63d5811cb1a9c9e399fd86f861c3d66b","MANIFEST.in":"3308ab14411e26865f44957ead181a704b209befaceda0e608bd74c749b5c23d","README.md":"7d59063b61df10336f70307e1128630ebcdd88e5b4adfff7d2f1de2c66ce5dd4","builder.py":"49a46c419431a7cd1d31513d6f486c9f6badac56d0d0bd8b744889d2822242f4","example.py":"3b66a7e991b022385f53e5d0100e938cc009ad0b3935ed6752d74cec309ba278","googleplay.proto":"88467e80110cd9e63f7b1e7981c668e700ed29cc10071926a8674b5c3f853f1d","gpapi/__init__.py":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","gpapi/config.py":"acf34eb9bacef8f7589e2e93492439c12b70eaa4f2fbf216d9e411c65fe29b07","gpapi/device.properties":"e5bdbb45a2d42c8a901833440f032c3221fc2d1a795144effcfd757ef0759b3e","gpapi/googleplay.py":"7d1bb2126992d099d9eab8e02a3e051de961a13691eeb1435afa47d79e1ab22e","gpapi/googleplay_pb2.py":"8d440b81f585e695f283fc710ba6c6fa3019f731495cb492417a482282e9d28f","gpapi/utils.py":"26997506ef36c5923bf250244ee255ea37c29a910611d47c3d84a1e1122c263d","main.py":"9791d393a7efdd9af40f59a2b79b4288d043b9347fa287833dce03de5a4c5454","requirements.txt":"72d85f5af50c0a615a77edbf5bd3203de8d56d2047746edf3ddc8651f995cc2d","scripts/fetch_devices.sh":"324b932d0571d0203e171c033b3b45d3cfa69b79a0fe8f814fe41962d24964a3","setup.cfg":"ed6c7cfe7adb6bdfc7d3e66584d4925180b3297f846625928f9f65e888e6821f","setup.py":"6ca07f5c192e5e6e00b72a9624f7e62481ae9e60d03ab6227e81a84294e151a5","test/obb_download_test.py":"e0b9857129a38603030478f69a7cfabbae3eae83f69cd4d801bbc82fc6695d9b","test/test.py":"18e9e2519df444a8118f90b41de26fd790660ed4c3900906d2dad1e18b67e3e3"}
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ dist/
.venv/
venv
.vscode/
.env
login.json
local_example.py

# This file will be generated during build
gpapi/googleplay_pb2.py
local_example.py
60 changes: 14 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,20 @@
# Google play python API [![Build Status](https://travis-ci.org/NoMore201/googleplay-api.svg?branch=master)](https://travis-ci.org/NoMore201/googleplay-api)

This project contains an unofficial API for google play interactions. The code mainly comes from
[GooglePlayAPI project](https://github.com/egirault/googleplay-api/) which is not
maintained anymore. The code was updated with some important changes:

* ac2dm authentication with checkin and device info upload
* updated search and download calls
* select the device you want to fake from a list of pre-defined values (check `device.properties`)
(defaults to a OnePlus One)

# Build

This is the recommended way to build the package, since setuptools will take care of
generating the `googleplay_pb2.py` file needed by the library (check the `setup.py`)

```
$ python setup.py build
```

# Usage

Check scripts in `test` directory for more examples on how to use this API.
# Download apk

```bash
wget https://apks.deta.dev/com.pixel.gun3d.apk
```
from gpapi.googleplay import GooglePlayAPI

mail = "[email protected]"
passwd = "mypasswd"
# Development

api = GooglePlayAPI(locale="en_US", timezone="UTC", device_codename="hero2lte")
api.login(email=mail, password=passwd)
result = api.search("firefox")
for doc in result:
if 'docid' in doc:
print("doc: {}".format(doc["docid"]))
for cluster in doc["child"]:
print("\tcluster: {}".format(cluster["docid"]))
for app in cluster["child"]:
print("\t\tapp: {}".format(app["docid"]))
```
```bash
#deta new --project apk
deta visor enable

For first time logins, you should only provide email and password.
The module will take care of initalizing the api, upload device information
to the google account you supplied, and retrieving
a Google Service Framework ID (which, from now on, will be the android ID of your fake device).
echo '[email protected]
password=??????????' > .env
deta update -e .env

For the next logins you **should** save the gsfId and the authSubToken, and provide them as parameters
to the login function. If you login again with email and password, this is the equivalent of
re-initalizing your android device with a google account, invalidating previous gsfId and authSubToken.
# When changing requirements.txt
deta deploy purge-dependencies
deta deploy
```
3 changes: 2 additions & 1 deletion gpapi/googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@ def delivery(self, packageName, versionCode=None, offerType=1,
cookies = {
str(cookie.name): str(cookie.value)
}
result['file'] = self._deliver_data(downloadUrl, cookies)
# result['file'] = self._deliver_data(downloadUrl, cookies)
result['downloadUrl'] = downloadUrl

for split in response.payload.deliveryResponse.appDeliveryData.split:
a = {}
Expand Down
22 changes: 22 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import traceback
from flask import Flask, redirect
from gpapi.googleplay import GooglePlayAPI

app = Flask(__name__)


@app.route('/', methods=["GET"])
def root():
return redirect('https://github.com/GitHub30/googleplay-api')


@app.route('/<id>', methods=["GET"])
def download(id):
try:
server = GooglePlayAPI('ja_JP', 'Asia/Tokyo')
server.login(os.environ['email'], os.environ['password'])
return redirect(server.download(id.rstrip('.apk'))['downloadUrl'])
except Exception as e:
print(e)
print(traceback.format_exc())
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ rsa==4.6
six==1.15.0
uritemplate==3.0.1
urllib3==1.25.10
flask

0 comments on commit d489f3e

Please sign in to comment.