diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b2d8cbb..b9fdfb6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,7 +27,7 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - tag_name: "v0.1.0" + tag_name: "v0.1.1" name: Release draft: false files: ./release/* diff --git a/start.sh b/start.sh index 9c5451c..eecf726 100644 --- a/start.sh +++ b/start.sh @@ -29,4 +29,7 @@ mkdir -p pakages && mv *.apk pakages/ tar -czvf pakages.tar.gz pakages mkdir -p release mv pakages.tar.gz release/ -# test -f "nikgapps.zip" && mv "nikgapps.zip" release/ + +if [[ -f "nikgapps.zip" ]]; then + mv "nikgapps.zip" release/ +fi \ No newline at end of file diff --git a/xapps2/main.py b/xapps2/main.py index db5ceaf..c11a83c 100644 --- a/xapps2/main.py +++ b/xapps2/main.py @@ -25,7 +25,7 @@ async def limit_coro( async def main(): - re.compile(r"[^A-Za-z0-9]") + async with ApkDL() as apk_dl: with open("config.yaml", "r") as f: @@ -33,7 +33,7 @@ async def main(): tasks: List = [] - sem = asyncio.Semaphore(8) + sem = asyncio.Semaphore(6) for addon in apps_conf["addons"]: if func := getattr(apk_dl, addon, None): diff --git a/xapps2/miscdl.py b/xapps2/miscdl.py index 2e4b70b..d1d37c4 100644 --- a/xapps2/miscdl.py +++ b/xapps2/miscdl.py @@ -24,7 +24,6 @@ def __init__(self): self.mixplorer_regex = re.compile( r"(?<=/)attachments/mixplorer_v(?:[6-9]|\d{2,})-[\d-]+api[\w-]+-apk\.\d+" ) - super().__init__() async def _get_json(self, url: str) -> Optional[Dict]: @@ -55,19 +54,6 @@ async def mixplorer(self, varient: str = "") -> Optional[str]: if match := self.mixplorer_regex.search(text): return f"{Sources.xda}{match.group(0)}" - # async def vlc(self) -> Optional[str]: - # try: - # async with self.http.get(Sources.vlc) as resp: - # assert resp.status == 200 - # text = await resp.text() - # version = BeautifulSoup(text, "lxml").findAll("a")[-1].get("href")[:-1] - # except Exception: - # version = "3.3.4" - # apk_url = f"{Sources.vlc}{version}/VLC-Android-{version}-{DEVICE.arch}.apk" - # async with self.http.get(apk_url) as apk: - # if apk.status == 200: - # return apk_url - async def json_api(self, link: str, args: List[str]) -> Optional[str]: if resp := await self._get_json(link): while len(args) != 0: @@ -99,7 +85,10 @@ async def niksgapps(self, varient: str = "basic") -> Optional[str]: if DEVICE.arch != "arm64-v8a": return if link := await get_nikgapps(DEVICE.android_str, varient): - return link - # async with self.http.get(link) as resp: - # assert resp.status == 200 - # return resp.url # redirected direct download link + async with self.http.get(link) as resp: + assert resp.status == 200 + text = await resp.text() + if match := re.search( + r"\S+)\">direct\slink", text + ): + return match.group("link") diff --git a/xapps2/nikgappsdl.py b/xapps2/nikgappsdl.py index a873ba4..fa922dd 100644 --- a/xapps2/nikgappsdl.py +++ b/xapps2/nikgappsdl.py @@ -1,7 +1,7 @@ __all__ = ["get_nikgapps"] from typing import Iterator, Literal, Optional - +import re import feedparser @@ -20,8 +20,11 @@ async def get_nikgapps( gapp_choice = (f"nikgapps-{varient}-{arch}").lower() async for sf_link in iter_releases(android_str): if gapp_choice in sf_link.lower(): - dl_link = f"{sf_link}?use_mirror=autoselect" break else: - dl_link = None - return dl_link + return + if match := re.match( + "https://sourceforge\.net/projects/nikgapps/files/(?P\S+\.zip)(?:/download)?", + sf_link, + ): + return f"https://sourceforge.net/settings/mirror_choices?projectname=nikgapps&filename={match.group('file')}" diff --git a/xapps2/test.py b/xapps2/test.py deleted file mode 100644 index a02d7de..0000000 --- a/xapps2/test.py +++ /dev/null @@ -1,8 +0,0 @@ -import re - -import yaml - -with open("config.yaml", "r") as f: - apps_conf = yaml.load(f, Loader=yaml.FullLoader) -for app in apps_conf["custom"]: - print("_".join(re.sub(r"[^A-Za-z0-9]", " ", app["app"]).split()) + ".apk")