From ad125bfb7b72db9d7b12f33a6c69a7fa76f217fb Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 13 Nov 2024 23:49:11 -0600 Subject: [PATCH] fix: Work with the new API --- src/ReVancedBuilder/APKPure_dl.py | 15 +++++---------- src/ReVancedBuilder/JAVABuilder.py | 2 +- src/ReVancedBuilder/ReVancedBuilder.py | 2 +- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/ReVancedBuilder/APKPure_dl.py b/src/ReVancedBuilder/APKPure_dl.py index ab0090b..48df5f4 100644 --- a/src/ReVancedBuilder/APKPure_dl.py +++ b/src/ReVancedBuilder/APKPure_dl.py @@ -96,9 +96,7 @@ def get_apks(appstate): # Get latest patches using the ReVanced API try: # Get the first result - patches_json = next(filter( - lambda x: x['repository'] == 'revanced/revanced-patches', appstate['tools'])) - patches = session.get(patches_json['browser_download_url']).json() + patches = session.get('https://api.revanced.app/v4/patches/list').json() except session.exceptions.RequestException as e: err_exit(f"Error fetching patches, {e}", appstate) @@ -123,13 +121,10 @@ def get_apks(appstate): hard_version = False compatible_vers = [] for patch in patches: - if patch['compatiblePackages'] is not None: - for pkg in patch['compatiblePackages']: - if pkg['name'] == apk: - try: - compatible_vers.append(pkg['versions'][-1]) - except TypeError: - pass + try: + compatible_vers.append(patch['compatiblePackages'][apk][-1]) + except (KeyError, TypeError): + pass if not compatible_vers: required_ver = Version('0') diff --git a/src/ReVancedBuilder/JAVABuilder.py b/src/ReVancedBuilder/JAVABuilder.py index b948702..24b069f 100644 --- a/src/ReVancedBuilder/JAVABuilder.py +++ b/src/ReVancedBuilder/JAVABuilder.py @@ -36,7 +36,7 @@ def build_apps(appstate): continue # Build the command to be run - cmd = 'java -jar revanced-cli.jar patch -b revanced-patches.jar -m revanced-integrations.apk' + cmd = 'java -jar revanced-cli.jar patch -p revanced-patches.rvp' try: root = build_config[app].getboolean('root') diff --git a/src/ReVancedBuilder/ReVancedBuilder.py b/src/ReVancedBuilder/ReVancedBuilder.py index 7cd39e8..9ac2466 100755 --- a/src/ReVancedBuilder/ReVancedBuilder.py +++ b/src/ReVancedBuilder/ReVancedBuilder.py @@ -21,7 +21,7 @@ from ReVancedBuilder.Cleanup import move_apps, err_exit # Update the ReVanced tools, if needed def update_tools(appstate): - for item in ['revanced-cli', 'revanced-integrations', 'revanced-patches']: + for item in ['revanced-cli', 'revanced-patches']: print(f"Checking updates for {item}...") tools = appstate['tools'] tool = next(filter(lambda x: x['repository'] == 'revanced/'+item and x['content_type'] not in ['application/pgp-keys', 'application/json'], tools))