diff --git a/pyproject.toml b/pyproject.toml index 3ed5187..810c837 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ requires-python = ">=3.6" keywords = ["revanced", "patch"] license = { file = "LICENSE" } classifiers = ["Programming Language :: Python :: 3"] -dependencies = ["cloudscraper", "packaging", "bs4"] +dependencies = ["cloudscraper", "requests", "packaging", "bs4"] version = "1.2" [project.scripts] diff --git a/src/ReVancedBuilder/APKPure_dl.py b/src/ReVancedBuilder/APKPure_dl.py index 852f4c9..d000705 100644 --- a/src/ReVancedBuilder/APKPure_dl.py +++ b/src/ReVancedBuilder/APKPure_dl.py @@ -4,8 +4,6 @@ # SPDX-License-Identifier: GPL-3.0-only import os -import sys -import json from packaging.version import Version import cloudscraper as scraper @@ -90,17 +88,18 @@ def get_apks(appstate): print('Downloading required apk files from APKPure...') + # Create a cloudscraper session + session = scraper.create_scraper() + # 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 = req.get(patches_json['browser_download_url']).json() - except req.exceptions.RequestException as e: + patches = session.get(patches_json['browser_download_url']).json() + except session.exceptions.RequestException as e: err_exit(f"Error fetching patches, {e}", appstate) - session = scraper.create_scraper() - for app in build_config: # Check if we need to build an app if not build_config[app].getboolean('build'):