mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-12-26 03:11:49 +01:00
Fallback to sourceforge rss when opengapps api fails (#170)
This commit is contained in:
parent
d28ed1f18b
commit
3e5dbc2633
15
.github/workflows/magisk.yml
vendored
15
.github/workflows/magisk.yml
vendored
@ -148,16 +148,19 @@ jobs:
|
|||||||
import os
|
import os
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
arch = "${{ matrix.arch }}"
|
arch = "${{ matrix.arch }}"
|
||||||
variant = "${{ github.event.inputs.gapps_variant }}"
|
variant = "${{ github.event.inputs.gapps_variant }}"
|
||||||
abi_map = {"x64" : "x86_64", "arm64": "arm64"}
|
abi_map = {"x64" : "x86_64", "arm64": "arm64"}
|
||||||
|
try:
|
||||||
res = requests.get(f"https://api.opengapps.org/list")
|
res = requests.get(f"https://api.opengapps.org/list")
|
||||||
|
j = json.loads(res.content)
|
||||||
j = json.loads(res.content)
|
link = {i["name"]: i for i in j["archs"][abi_map[arch]]["apis"]["11.0"]["variants"]}[variant]["zip"]
|
||||||
|
except Exception:
|
||||||
link = {i["name"]: i for i in j["archs"][abi_map[arch]]["apis"]["11.0"]["variants"]}[variant]["zip"]
|
print("Failed to fetch from opengapps api, fallbacking to sourceforge rss...")
|
||||||
|
res = requests.get(f'https://sourceforge.net/projects/opengapps/rss?path=/{abi_map[arch]}&limit=100')
|
||||||
|
link = re.search(f'https://.*{abi_map[arch]}/.*{variant}.*\.zip/download', res.text).group().replace('.zip/download', '.zip').replace('sourceforge.net/projects/opengapps/files', 'downloads.sourceforge.net/project/opengapps')
|
||||||
|
|
||||||
print(f"downloading link: {link}", flush=True)
|
print(f"downloading link: {link}", flush=True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user