mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-16 03:55:28 +00:00
👷 Fix action download apk
This commit is contained in:
parent
ddf77ef162
commit
6c4f1dd9e7
5
.github/workflows/ds.yml
vendored
5
.github/workflows/ds.yml
vendored
@ -25,11 +25,12 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
cache: 'gradle'
|
cache: 'gradle'
|
||||||
|
- name: Install jq
|
||||||
|
run: sudo apt-get install -y jq
|
||||||
- name: Download apk
|
- name: Download apk
|
||||||
run: |
|
run: |
|
||||||
pip install httpx
|
|
||||||
cd compiler/ds
|
cd compiler/ds
|
||||||
python download.py ${{ secrets.DOWNLOAD }}
|
curl -H 'x-rpc-client_type: 2' -H 'x-rpc-app_version: 2.37.1' -H 'x-rpc-channel: miyousheluodi' https://api-takumi.mihoyo.com/ptolemaios/api/getLatestRelease | jq --raw-output '.data.package_url' | xargs curl -o mihoyobbs.apk
|
||||||
- name: Parse apk
|
- name: Parse apk
|
||||||
run: |
|
run: |
|
||||||
cd compiler/ds
|
cd compiler/ds
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
from time import sleep
|
|
||||||
|
|
||||||
from httpx import get
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
url = sys.argv[1] if len(sys.argv) > 1 else "https://download-bbs.miyoushe.com"
|
|
||||||
|
|
||||||
|
|
||||||
def retry(func):
|
|
||||||
"""retry 10 times"""
|
|
||||||
|
|
||||||
def wrapper(*args, **kwargs) -> str:
|
|
||||||
"""retry 10 times"""
|
|
||||||
for _ in range(10):
|
|
||||||
try:
|
|
||||||
return func(*args, **kwargs)
|
|
||||||
except Exception: # skipcq: PYL-W0703
|
|
||||||
print("retrying...")
|
|
||||||
sleep(1)
|
|
||||||
continue
|
|
||||||
return None
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
|
|
||||||
@retry
|
|
||||||
def get_version():
|
|
||||||
"""get version"""
|
|
||||||
return get(
|
|
||||||
"https://bbs-api.miyoushe.com/misc/wapi/getLatestPkgVer?channel=miyousheluodi",
|
|
||||||
verify=False,
|
|
||||||
).json()[
|
|
||||||
"data"
|
|
||||||
]["version"]
|
|
||||||
|
|
||||||
|
|
||||||
version = get_version()
|
|
||||||
apk_url = f"{url}/app/mihoyobbs_{version}_miyousheluodi.apk"
|
|
||||||
print(f"download version {version} from {apk_url}")
|
|
||||||
|
|
||||||
command = f"wget -O mihoyobbs.apk {apk_url}"
|
|
||||||
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # skipcq: BAN-B602
|
|
||||||
output, error = process.communicate()
|
|
||||||
|
|
||||||
print("命令输出:\n", output.decode())
|
|
||||||
print("错误信息:\n", error.decode())
|
|
Loading…
Reference in New Issue
Block a user