forked from marty0678/googleplay-api
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
27 lines (22 loc) · 686 Bytes
/
main.py
File metadata and controls
27 lines (22 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import re
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:
id = re.sub('\.apk$', '', id)
print(id)
server = GooglePlayAPI('ja_JP', 'Asia/Tokyo')
server.login(os.environ['email'], os.environ['password'])
download = server.download(id)
print(download)
return redirect(download['downloadUrl'])
except Exception as e:
print(e)
print(traceback.format_exc())