From 568a0eb9ef1326da3a13736144a138317a0d43bb Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 3 Feb 2023 17:59:55 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E4=BC=98=E5=85=88=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=20arm64=20apk=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defs/source.py | 9 +++++++-- requirements.txt | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/defs/source.py b/defs/source.py index b7b6b40..d180fd7 100644 --- a/defs/source.py +++ b/defs/source.py @@ -65,8 +65,13 @@ async def download(url: str, name: str, pack_name: str) -> (str, str): data = Module(content) url = None if data.releases and data.releases[0].releaseAssets: - url = data.releases[0].releaseAssets[0].url - mime = data.releases[0].releaseAssets[0].name.split(".")[-1:][0] + # find arm64 or universal first + asset = next( + (i for i in data.releases[0].releaseAssets if "arm64" in i.name or "universal" in i.name), + data.releases[0].releaseAssets[0], + ) + url = asset.url + mime = asset.name.split(".")[-1:][0] name = data.name.replace('.', '_') + "-" + data.latestRelease + "." + mime if not url: raise FileNotFoundError diff --git a/requirements.txt b/requirements.txt index f2480be..4e6b579 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -Pyrogram>=2.0.59 -Tgcrypto>=1.2.4 +Pyrogram==2.0.97 +Tgcrypto==1.2.5 httpx>=0.22.0 apscheduler>=3.8.1 sqlitedict>=2.0.0