- setup-revanced-new.cmd
- Internet connection
- Run
setup-revanced-new.cmd
file by double clicking. - Follow the instruction from the cmd window.
setup-revanced-new.cmd
file by double clicking.@echo off | |
@title ReVanced cli script | |
setlocal enabledelayedexpansion | |
REM Fetch and extract URL from the first API | |
for /f "usebackq tokens=*" %%a in (` | |
powershell -command "& {(Invoke-WebRequest -Uri 'https://api.revanced.app/v2/revanced-patches/releases' | ConvertFrom-Json).releases[0].assets.browser_download_url}" | |
`) do set patches_url=%%a | |
REM Fetch and extract URL from the second API | |
for /f "usebackq tokens=*" %%a in (` | |
powershell -command "& {(Invoke-WebRequest -Uri 'https://api.revanced.app/v2/revanced-cli/releases' | ConvertFrom-Json).releases[0].assets.browser_download_url}" | |
`) do set cli_url=%%a | |
REM Fetch and extract URL from the third API | |
for /f "usebackq tokens=*" %%a in (` | |
powershell -command "& {(Invoke-WebRequest -Uri 'https://api.revanced.app/v2/revanced-integrations/releases' | ConvertFrom-Json).releases[0].assets.browser_download_url}" | |
`) do set integrations_url=%%a | |
for %%F in (%patches_url%) do ( | |
set "patches=%%~nxF" | |
if exist "%CD%\%%~nxF" ( | |
echo File already exists. Skipping download. | |
) else ( | |
:: Download the file using Invoke-WebRequest with the original filename | |
powershell -command "Invoke-WebRequest -Uri %patches_url% -OutFile '%CD%\%%~nxF'" | |
) | |
) | |
for %%F in (%cli_url%) do ( | |
set "cli=%%~nxF" | |
if exist "%CD%\%%~nxF" ( | |
echo File already exists. Skipping download. | |
) else ( | |
:: Download the file using Invoke-WebRequest with the original filename | |
powershell -command "Invoke-WebRequest -Uri %cli_url% -OutFile '%CD%\%%~nxF'" | |
) | |
) | |
for %%F in (%integrations_url%) do ( | |
set "integrations=%%~nxF" | |
if exist "%CD%\%%~nxF" ( | |
echo File already exists. Skipping download. | |
) else ( | |
:: Download the file using Invoke-WebRequest with the original filename | |
powershell -command "Invoke-WebRequest -Uri %integrations_url% -OutFile '%CD%\%%~nxF'" | |
) | |
) | |
@COLOR 30 | |
for /f "delims=" %%i in ("%cli_url%") do set "cli=%%~nxi" | |
for /f "delims=" %%i in ("%integrations_url%") do set "integrations=%%~nxi" | |
for /f "delims=" %%i in ("%patches_url%") do set "patches=%%~nxi" | |
set yt_version= | |
for /f "tokens=1,2" %%a in ('java -jar %cli% list-versions %patches% --filter-package-names=com.google.android.youtube ^| findstr /V /C:"INFO: Package name: com.google.android.youtube" /C:"Most common compatible versions:"') do ( | |
set yt_version=%%a | |
goto :done | |
) | |
:done | |
echo. | |
echo CLI: %cli% | |
echo PATCHES: %patches% | |
echo INTEGRATIONS: %integrations% | |
echo Current supported YouTube app version: %yt_version% | |
echo. | |
echo Download the YouTube APK in your web browser now.^^! | |
set "yt_version_url=%yt_version:.=-%" | |
set "url=https://www.apkmirror.com/apk/google-inc/youtube/youtube-99-99-99-release/youtube-99-99-99-android-apk-download/" | |
set "url=%url:99-99-99=!yt_version_url!%" | |
TIMEOUT 4 > NUL | |
start %url% | |
echo. | |
echo Press any key when the download is finished | |
pause >nul | |
echo. | |
echo Choose the YouTube APK you just downloaded: | |
TIMEOUT 2 > NUL | |
set dialog="about:<input type=file id=FILE><script>FILE.click();new ActiveXObject | |
set dialog=%dialog%('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value); | |
set dialog=%dialog%close();resizeTo(0,0);</script>" | |
for /f "tokens=* delims=" %%p in ('mshta.exe %dialog%') do set "youtube_apk=%%p" | |
echo The selected file is: "%youtube_apk%" | |
echo. | |
echo Start patching... | |
TIMEOUT 2 > nul | |
java -jar %cli% patch ^ | |
--patch-bundle %patches% ^ | |
--merge %integrations% ^ | |
--exclude "Disable precise seeking gesture" ^ | |
--exclude "Enable debugging" ^ | |
--exclude "Enable slide to seek" ^ | |
--exclude "Playback speed" ^ | |
--exclude "Remove player controls background" ^ | |
--exclude "Restore old seekbar thumbnails" ^ | |
--exclude "Return YouTube Dislike" ^ | |
--exclude "Seekbar tapping" ^ | |
--exclude "Swipe controls" ^ | |
--include "Custom branding" ^ | |
%youtube_apk% | |
for /f %%i in ('adb shell getprop ro.serialno 2^>nul') do set deviceid=%%i | |
for /F "skip=1" %%i in ('adb devices 2^>nul') do set deviceid=%%i | |
if "%deviceid%"=="" ( | |
goto end | |
) else ( | |
goto menu | |
) | |
:menu | |
echo. | |
echo Install now? | |
choice /c YN /m "[Y] Yes [N] No (default is 'N'): " | |
if errorlevel 2 goto no | |
if errorlevel 1 goto yes | |
:no | |
goto end | |
:yes | |
adb shell "pm list packages app.revanced.android.youtube" |findstr . && GOTO HAS-YOUTUBE || GOTO NO-YOUTUBE | |
:NO-YOUTUBE | |
TIMEOUT 2 > NUL | |
ECHO. | |
set "youtube_apk=%youtube_apk:.apk=-patched.apk%" | |
@ECHO :: Installing %youtube_apk% (stock)... | |
java -jar %cli% utility install ^ | |
-a %youtube_apk% ^ | |
%deviceid% | |
:HAS-YOUTUBE | |
for /f "tokens=2 delims==" %%i in ('adb shell "dumpsys package app.revanced.android.youtube | grep versionName"') do set "yt_version_current=%%i" | |
for /f "tokens=2,3,4 delims=_|." %%x in ('echo %base%') do set "apkupd=%%x.%%y.%%z" | |
if NOT %yt_version% == %yt_version_current% ( | |
TIMEOUT 2 > NUL | |
ECHO. | |
@ECHO :: Outdated Youtube version detected... | |
@ECHO :: Uninstalling Youtube... | |
adb uninstall app.revanced.android.youtube | |
GOTO NO-YOUTUBE | |
) | |
goto end | |
:end | |
echo DONE! Press any key to exit. | |
pause > nul | |
@matega I did some testing. It was to prevent it from overlapping with other ADB shell commands.
Can you please make a script for non-root revanced
@rj1 Sure. I'll look into that later.
script for non-root revanced ?
Why do you litter it with timeouts? It takes at least half a minute more than it should this way.