mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
🐛 Fixed Failing Downloads
This commit is contained in:
@@ -10,6 +10,7 @@ from subprocess import PIPE, Popen
|
|||||||
from time import perf_counter
|
from time import perf_counter
|
||||||
from typing import Any, Dict, List, Tuple, Type
|
from typing import Any, Dict, List, Tuple, Type
|
||||||
|
|
||||||
|
import requests
|
||||||
from environs import Env
|
from environs import Env
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from requests import Session
|
from requests import Session
|
||||||
@@ -144,19 +145,17 @@ class Downloader(object):
|
|||||||
return version
|
return version
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def repository(
|
def repository(cls, owner: str, name: str, file_name: str) -> None:
|
||||||
cls,
|
|
||||||
owner: str,
|
|
||||||
name: str,
|
|
||||||
) -> None:
|
|
||||||
logger.debug(f"Trying to download {name} from github")
|
logger.debug(f"Trying to download {name} from github")
|
||||||
resp = session.get(f"{github}/{owner}/{name}/releases/latest")
|
repo_url = f"https://api.github.com/repos/{owner}/{name}/releases/latest"
|
||||||
parser = LexborHTMLParser(resp.text)
|
r = requests.get(
|
||||||
url = parser.css("li.Box-row > div:nth-child(1) > a:nth-child(2)")[:-2][
|
repo_url, headers={"Content-Type": "application/vnd.github.v3+json"}
|
||||||
-1
|
)
|
||||||
].attributes["href"]
|
if name == "revanced-patches":
|
||||||
extension = url.rfind(".")
|
download_url = r.json()["assets"][1]["browser_download_url"]
|
||||||
cls._download(github + url, name + url[extension:])
|
else:
|
||||||
|
download_url = r.json()["assets"][0]["browser_download_url"]
|
||||||
|
cls._download(download_url, file_name=file_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def report(cls) -> None:
|
def report(cls) -> None:
|
||||||
@@ -331,10 +330,10 @@ def pre_requisite():
|
|||||||
|
|
||||||
def download_revanced(downloader: Type[Downloader]) -> None:
|
def download_revanced(downloader: Type[Downloader]) -> None:
|
||||||
assets = (
|
assets = (
|
||||||
("revanced", "revanced-cli"),
|
("revanced", "revanced-cli", "revanced-cli.jar"),
|
||||||
("revanced", "revanced-integrations"),
|
("revanced", "revanced-integrations", "revanced-integrations.apk"),
|
||||||
("revanced", "revanced-patches"),
|
("revanced", "revanced-patches", "revanced-patches.jar"),
|
||||||
("inotia00", "VancedMicroG"),
|
("inotia00", "VancedMicroG", "VancedMicroG.apk"),
|
||||||
)
|
)
|
||||||
with ThreadPoolExecutor() as executor:
|
with ThreadPoolExecutor() as executor:
|
||||||
executor.map(lambda repo: downloader.repository(*repo), assets)
|
executor.map(lambda repo: downloader.repository(*repo), assets)
|
||||||
@@ -382,7 +381,6 @@ def main() -> None:
|
|||||||
logger.info(f"Will Patch only {apps}")
|
logger.info(f"Will Patch only {apps}")
|
||||||
for app in apps:
|
for app in apps:
|
||||||
try:
|
try:
|
||||||
is_experimental = False
|
|
||||||
arg_parser = ArgParser()
|
arg_parser = ArgParser()
|
||||||
logger.debug("Trying to build %s" % app)
|
logger.debug("Trying to build %s" % app)
|
||||||
app_patches, version, is_experimental = get_patches_version()
|
app_patches, version, is_experimental = get_patches_version()
|
||||||
|
|||||||
Reference in New Issue
Block a user