From 7d0e83eed1c7910744bc9790093eb209760e7447 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 24 Aug 2023 20:13:02 +0530 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=8E=A8=20Patch=20any=20application?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 2 +- src/app.py | 10 ++++++---- src/patches.py | 32 ++++++++++++++------------------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/main.py b/main.py index f3e65ae..d6832fa 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ def main() -> None: logger.info(app) parser.patch_app(app) except AppNotFound as e: - logger.info(f"Invalid app requested to build {e}") + logger.info(e) except PatchesJsonLoadFailed: logger.exception("Patches.json not found") except PatchingFailed as e: diff --git a/src/app.py b/src/app.py index 43c15b6..49e9c72 100644 --- a/src/app.py +++ b/src/app.py @@ -50,9 +50,8 @@ class APP(object): self.download_dl = config.env.str(f"{app_name}_DL".upper(), "") self.download_patch_resources(config) self.download_source = config.env.str(f"{app_name}_DL_SOURCE".upper(), "") - self.package_name = config.env.str( - f"{app_name}_PACKAGE_NAME".upper(), Patches.get_package_name(app_name) - ) + env_package_name = config.env.str(f"{app_name}_PACKAGE_NAME".upper(), None) + self.package_name = env_package_name or Patches.get_package_name(app_name) def download_apk_for_patching(self, config: RevancedConfig) -> None: """Download apk to be patched.""" @@ -73,7 +72,10 @@ class APP(object): self.package_name ) except KeyError: - raise DownloadFailure(f"No download source found for {self.app_name}") + raise DownloadFailure( + f"App {self.app_name} not supported officially yet. Please provide download " + f"source in env." + ) downloader = DownloaderFactory.create_downloader( config=config, apk_source=self.download_source ) diff --git a/src/patches.py b/src/patches.py index eaf6a97..03143cc 100644 --- a/src/patches.py +++ b/src/patches.py @@ -75,7 +75,9 @@ class Patches(object): for package, app_name in Patches.revanced_package_names.items(): if app_name == app: return package - raise AppNotFound(f"App {app} not supported yet.") + raise AppNotFound( + f"App {app} not supported officially yet. Please provide package name in env to proceed." + ) @staticmethod def support_app() -> Dict[str, str]: @@ -100,6 +102,7 @@ class Patches(object): app : APP The `app` parameter is of type `APP`. It represents an instance of the `APP` class. """ + self.patches_dict[app.app_name] = [] patch_loader = PatchLoader() patches = patch_loader.load_patches( f'{config.temp_folder}/{app.resource["patches_json"]}' @@ -111,20 +114,17 @@ class Patches(object): p["app"] = "universal" p["version"] = "all" self.patches_dict["universal_patch"].append(p) - for compatible_package, version in [ - (x["name"], x["versions"]) for x in patch["compatiblePackages"] - ]: - if compatible_package in self.revanced_package_names.keys(): - app_name = self.revanced_package_names[compatible_package] - if not self.patches_dict.get(app_name, None): - self.patches_dict[app_name] = [] - p = {x: patch[x] for x in ["name", "description"]} - p["app"] = compatible_package - p["version"] = version[-1] if version else "all" - self.patches_dict[app_name].append(p) + else: + for compatible_package, version in [ + (x["name"], x["versions"]) for x in patch["compatiblePackages"] + ]: + if app.package_name == compatible_package: + p = {x: patch[x] for x in ["name", "description"]} + p["app"] = compatible_package + p["version"] = version[-1] if version else "all" + self.patches_dict[app.app_name].append(p) - n_patches = len(self.patches_dict[app.app_name]) - app.no_of_patches = n_patches + app.no_of_patches = len(self.patches_dict[app.app_name]) def __init__(self, config: RevancedConfig, app: APP) -> None: self.patches_dict: Dict[str, Any] = {"universal_patch": []} @@ -146,10 +146,6 @@ class Patches(object): patches for the given app. The second element is a string representing the version of the patches. """ - app_names = self.revanced_package_names - - if app not in app_names.values(): - raise AppNotFound(f"App {app} not supported yet.") patches = self.patches_dict[app] version = "latest" From 9853edcfefc6ef0c7cfb4201379902efe2cf3622 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 24 Aug 2023 21:39:15 +0530 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Updated=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 77 ++++++++++++++++++++++++++++++++++++++++------------ README.md | 31 ++++++++++++++++++--- 2 files changed, 87 insertions(+), 21 deletions(-) diff --git a/.env.example b/.env.example index 739ab17..04ced1a 100644 --- a/.env.example +++ b/.env.example @@ -1,29 +1,72 @@ -#GLobal envs -PATCH_APPS=youtube,youtube_music,twitter +#Global: +EXTRA_FILES=https://github.com/inotia00/VancedMicroG/releases/latest@VancedMicroG.apk,https://github.com/inotia00/mMicroG/releases@mmicrog.apk +PATCH_APPS=youtube,youtube_revancify_red,youtube_revancify_blue,youtube_mmt,youtube_music,reddit GLOBAL_CLI_DL=https://github.com/revanced/revanced-cli GLOBAL_PATCHES_DL=https://github.com/revanced/revanced-patches GLOBAL_PATCHES_JSON_DL=https://github.com/revanced/revanced-patches GLOBAL_INTEGRATIONS_DL=https://github.com/revanced/revanced-integrations -EXISTING_DOWNLOADED_APKS=youtube,youtube_music + +#Example +EXISTING_DOWNLOADED_APKS=twitter PERSONAL_ACCESS_TOKEN=ghp_asample_token -#YouTune -YOUTUBE_CLI_DL=https://github.com/revanced/revanced-cli -YOUTUBE_PATCHES_DL=https://github.com/revanced/revanced-patches -YOUTUBE_PATCHES_JSON_DL=https://github.com/revanced/revanced-patches -YOUTUBE_INTEGRATIONS_DL=https://github.com/revanced/revanced-integrations +#YouTube: +YOUTUBE_CLI_DL=https://github.com/inotia00/revanced-cli +YOUTUBE_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations +YOUTUBE_EXCLUDE_PATCH=custom-branding-icon-revancify-blue,custom-branding-icon-revancify-red,custom-branding-icon-mmt,custom-branding-youtube-name,enable-debug-logging + +#Example YOUTUBE_KEYSTORE_FILE_NAME=youtube.keystore YOUTUBE_ARCHS_TO_BUILD=arm64-v8a,armeabi-v7a -YOUTUBE_EXCLUDE_PATCH=custom-branding,hide-get-premium -YOUTUBE_INCLUDE_PATCH=remove-screenshot-restriction -YOUTUBE_VERSION=17.31.36 -#YOUTUBE_MUSIC Music -YOUTUBE_MUSIC_CLI_DL=https://github.com/revanced/revanced-cli/releases/tag/v2.22.1 -YOUTUBE_MUSIC_PATCHES_DL=https://github.com/revanced/revanced-patches -YOUTUBE_MUSIC_PATCHES_JSON_DL=https://github.com/revanced/revanced-patches -YOUTUBE_MUSIC_INTEGRATIONS_DL=https://github.com/revanced/revanced-integrations -YOUTUBE_MUSIC_EXCLUDE_PATCH=yt-music-is-shit + +#YouTube Revancify Red: +YOUTUBE_REVANCIFY_RED_PACKAGE_NAME=com.google.android.youtube +YOUTUBE_REVANCIFY_RED_DL_SOURCE=https://www.apkmirror.com/apk/google-inc/youtube/ +YOUTUBE_REVANCIFY_RED_CLI_DL=https://github.com/inotia00/revanced-cli +YOUTUBE_REVANCIFY_RED_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_REVANCIFY_RED_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_REVANCIFY_RED_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations +YOUTUBE_REVANCIFY_RED_EXCLUDE_PATCH=custom-branding-icon-revancify-blue,custom-branding-icon-mmt,custom-branding-youtube-name,enable-debug-logging + +#YouTube Revancify Blue: +YOUTUBE_REVANCIFY_BLUE_PACKAGE_NAME=com.google.android.youtube +YOUTUBE_REVANCIFY_BLUE_DL_SOURCE=https://www.apkmirror.com/apk/google-inc/youtube/ +YOUTUBE_REVANCIFY_BLUE_CLI_DL=https://github.com/inotia00/revanced-cli +YOUTUBE_REVANCIFY_BLUE_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_REVANCIFY_BLUE_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_REVANCIFY_BLUE_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations +YOUTUBE_REVANCIFY_BLUE_EXCLUDE_PATCH=custom-branding-icon-revancify-red,custom-branding-icon-mmt,custom-branding-youtube-name,enable-debug-logging + + + + +#YouTube MMT: +YOUTUBE_MMT_PACKAGE_NAME=com.google.android.youtube +YOUTUBE_MMT_DL_SOURCE=https://www.apkmirror.com/apk/google-inc/youtube/ +YOUTUBE_MMT_CLI_DL=https://github.com/inotia00/revanced-cli +YOUTUBE_MMT_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_MMT_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_MMT_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations +YOUTUBE_MMT_EXCLUDE_PATCH=custom-branding-icon-revancify-blue,custom-branding-icon-revancify-red,custom-branding-youtube-name,enable-debug-logging + +#YouTube Music: +YOUTUBE_MUSIC_CLI_DL=https://github.com/inotia00/revanced-cli +YOUTUBE_MUSIC_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_MUSIC_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +YOUTUBE_MUSIC_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations +YOUTUBE_MUSIC_EXCLUDE_PATCH=custom-branding-icon-mmt,custom-branding-icon-revancify-blue,custom-branding-icon-revancify-red,custom-branding-music-name,enable-compact-dialog,enable-debug-logging +YOUTUBE_MUSIC_VERSION=6.15.52 + + +#Reddit +REDDIT_CLI_DL=https://github.com/inotia00/revanced-cli +REDDIT_PATCHES_DL=https://github.com/YT-Advanced/ReX-patches +REDDIT_PATCHES_JSON_DL=https://github.com/YT-Advanced/ReX-patches +REDDIT_INTEGRATIONS_DL=https://github.com/YT-Advanced/ReX-integrations + #Twitter TWITTER_VERSION=latest diff --git a/README.md b/README.md index d2e52dc..1465f63 100644 --- a/README.md +++ b/README.md @@ -152,14 +152,16 @@ You can use any of the following methods to build. | [*APP_NAME*_EXCLUDE_PATCH**](#custom-exclude-patching) | Patches to exclude while patching **APP_NAME**. | [] | | [*APP_NAME*_INCLUDE_PATCH**](#custom-include-patching) | Patches to include while patching **APP_NAME**. | [] | | [*APP_NAME*_VERSION**](#app-version) | Version to use for download for patching. | Recommended by patch resources | -| [*APP_NAME*_DL](#app-dl) | | | +| [*APP_NAME*_DL](#app-dl) | Direct download Link for clean apk | None | +| [*APP_NAME*_DL_SOURCE](#any-patch-apps) | Download source of any of the supported scrapper | None | +| [*APP_NAME*_DL_SOURCE](#any-patch-apps) | Package name of the app to be patched | None | `**` - By default all patches for a given app are included.
`**` - Can be used to included universal patch. ## Note -1. Supported values for **APP_NAME** are : +1. **Officially** Supported values for **APP_NAME**** are : 1. [youtube](https://www.apkmirror.com/apk/google-inc/youtube/) 2. [youtube_music](https://www.apkmirror.com/apk/google-inc/youtube-music/) @@ -201,10 +203,31 @@ You can use any of the following methods to build. 38. [bacon](https://www.apkmirror.com/apk/onelouder-apps/baconreader-for-reddit/) 39. [microg](https://github.com/inotia00/mMicroG/releases) 40. [pixiv](https://www.apkmirror.com/apk/pixiv-inc/pixiv/) +
`**` - You can also patch any other app which is **not** supported officially.To do so, you need to provide + few more inputs to the tool which are mentioned below. + ```ini + _DL_SOURCE= + _PACKAGE_NAME= + ``` + You can also provide DL to the clean apk instead of providing DL_SOURCES as mentioned in this [note](#app-dl) + Supported Scrappers are + 1. APKMIRROR - Supports downloading any versions + 1. Link Format - https://www.apkmirror.com/apk//app-name/ + 2. Example Link - https://www.apkmirror.com/apk/google-inc/youtube/ + 2. UPTODOWN - Supports downloading any versions + 1. Link Format - https://.en.uptodown.com/android + 2. Example Link - https://spotify.en.uptodown.com/android + 3. APKSOS - Supports downloading any versions + 1. Link Format - https://apksos.com/download-app/ + 2. Example Link - https://apksos.com/download-app/com.expensemanager + 4. APKPURE - Supports downloading only latest version + 1. Link Format - https://d.apkpure.com/b/APK/?version=latest + 2. Example Link - https://d.apkpure.com/b/APK/com.google.android.youtube?version=latest -
Please verify the source of original APKs yourself with links provided. I'm not responsible for any damage +
Please verify the source of original APKs yourself with links provided. I'm not responsible for any damage caused.If you know any better/safe source to download clean. Open a discussion. -2. By default, script build the latest version as recommended by `patches.json` team. + +2. By default, script build the latest version mentioned in `patches.json` file. 3. Remember to download the **_Microg_**. Otherwise, you may not be able to open YouTube/YouTube Music. 4. By default, tool will build only `youtube`. To build other apps supported by patching resources.Add the apps you want to build in `.env` file or in `ENVS` in `GitHub secrets` in the format From eacfce42647c7f40103166c86a5d90e8815ce9cb Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 24 Aug 2023 21:57:29 +0530 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=A8=20Lint=20Fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.py b/src/app.py index 49e9c72..861be54 100644 --- a/src/app.py +++ b/src/app.py @@ -74,7 +74,7 @@ class APP(object): except KeyError: raise DownloadFailure( f"App {self.app_name} not supported officially yet. Please provide download " - f"source in env." + "source in env." ) downloader = DownloaderFactory.create_downloader( config=config, apk_source=self.download_source From 45df0d83314c857c30391c7b5035648ac074e8e1 Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Thu, 24 Aug 2023 21:59:16 +0530 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=A8=20Doc=20Fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1465f63..4765b99 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ You can get pre-built apks [here](https://revanced_apkss.t.me/) You can use any of the following methods to build. -- πŸš€ **_GitHub**_ (**_`Recommended`_**) +- πŸš€ **GitHub** (**_`Recommended`_**) 1. Click Star to support the project.

@@ -48,40 +48,25 @@ You can use any of the following methods to build. - 🐳 **_Docker Compose_**
- Windows/Mac users simply install Docker Desktop. If using Linux see below - 1. Install Docker(Skip if already installed) - ```bash - curl -fsSL https://get.docker.com -o get-docker.sh - sh get-docker.sh - ``` - 2. Grant Permissions with(Skip if already there) - ```bash - sudo chmod 777 /var/run/docker.sock - ``` - 3. Install Docker compose(Skip if already installed or using **_`Docker Desktop`_**) - ```bash - curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" \ - -o /usr/local/bin/docker-compose - sudo chmod +x /usr/local/bin/docker-compose - ``` - 4. Clone the repo + 1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop/). + 2. Clone the repo ```bash git clone https://github.com/nikhilbadyal/docker-py-revanced ``` - 5. cd to the cloned repo + 3. cd to the cloned repo ```bash cd docker-py-revanced ``` - 6. Update `.env` file if you want some customization(See notes) - 7. Run script with + 4. Update `.env` file if you want some customization(See notes) + 5. Run script with ```shell docker-compose up --build ``` - 🐳With Docker - 1. Install Docker(Skip if already installed) + 1. Install Docker or [Docker Desktop](https://www.docker.com/products/docker-desktop/). ```bash curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh