fix: Work with the new API

This commit is contained in:
Sayantan Santra 2024-11-13 23:49:11 -06:00
parent 64ab240a8a
commit ad125bfb7b
Signed by: SinTan1729
GPG key ID: 0538DD402EA50898
3 changed files with 7 additions and 12 deletions

View file

@ -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,12 +121,9 @@ 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:
compatible_vers.append(patch['compatiblePackages'][apk][-1])
except (KeyError, TypeError):
pass
if not compatible_vers:

View file

@ -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')

View file

@ -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))