diff --git a/scripts/generateMagiskLink.py b/scripts/generateMagiskLink.py index 0578c4b..e5b246e 100644 --- a/scripts/generateMagiskLink.py +++ b/scripts/generateMagiskLink.py @@ -32,8 +32,13 @@ print(f"Generating Magisk download link: release type={magisk_ver}", flush=True) if not magisk_ver: magisk_ver = "stable" if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or magisk_ver == "debug": - magisk_link = json.loads(requests.get( - f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link'] + try: + magisk_link = json.loads(requests.get( + f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link'] + except Exception: + print("Failed to fetch from GitHub API, fallbacking to jsdelivr...") + magisk_link = json.loads(requests.get( + f"https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)['magisk']['link'] print(f"download link: {magisk_link}", flush=True) with open(download_dir/tempScript, 'a') as f: