- setup-revanced-new.cmd
- Internet connection
- Run
setup-revanced-new.cmdfile 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/tools' | ConvertFrom-Json).tools[0].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/tools' | ConvertFrom-Json).tools[5].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/tools' | ConvertFrom-Json).tools[2].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" | |
| for /f "delims=" %%i in ('powershell -Command "$patches = (Invoke-WebRequest -Uri 'https://api.revanced.app/v4/patches/list' | ConvertFrom-Json); $patch = $patches | Where-Object { $_.compatiblePackages.'com.google.android.youtube' }; $lastVersion = $patch.compatiblePackages.'com.google.android.youtube'[-1]; $lastVersion"') do set LastVersion=%%i | |
| echo Last YouTube Version: %LastVersion% | |
| :done | |
| echo. | |
| echo CLI: %cli% | |
| echo PATCHES: %patches% | |
| echo INTEGRATIONS: %integrations% | |
| echo Current supported YouTube app version: %LastVersion% | |
| echo. | |
| echo Download the YouTube APK in your web browser now.^^! | |
| set "LastVersion_url=%LastVersion:.=-%" | |
| 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=!LastVersion_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 | |
| echo java -jar %cli% ^ | |
| patch -p %patches% ^ | |
| "%youtube_apk%" | |
| java -jar %cli% ^ | |
| patch -p %patches% ^ | |
| "%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 "LastVersion_current=%%i" | |
| for /f "tokens=2,3,4 delims=_|." %%x in ('echo %base%') do set "apkupd=%%x.%%y.%%z" | |
| if NOT %LastVersion% == %LastVersion_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.