├── .gitattributes ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── customize.sh ├── detachyt.sh ├── dynmount.sh ├── module.prop ├── mount.sh ├── post-fs-data.sh ├── revanced.apk ├── service.sh ├── sqlite3.zip └── utils.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text eol=lf 3 | 4 | # Declare files that will always have CRLF line endings on checkout. 5 | *.cmd text eol=crlf 6 | *.bat text eol=crlf -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | require_new_magisk() { 13 | ui_print "*******************************" 14 | ui_print " Please install Magisk v23.0+! " 15 | ui_print "*******************************" 16 | exit 1 17 | } 18 | 19 | ######################### 20 | # Load util_functions.sh 21 | ######################### 22 | 23 | OUTFD=$2 24 | ZIPFILE=$3 25 | 26 | mount /data 2>/dev/null 27 | 28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 29 | . /data/adb/magisk/util_functions.sh 30 | [ $MAGISK_VER_CODE -lt 23000 ] && require_new_magisk 31 | 32 | install_module 33 | exit 0 -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## YouTube ReVanced 2 | 3 | YouTube ReVanced package by HuskyDG 4 | 5 | ### Background 6 | 7 | - Dynamic mount YouTube ReVanced APK and make bind mount only be visible for YouTube App to avoid detection, other app will only see the original `base.apk` of YouTube. 8 | - Dynamic patch Play Store everytime opening app to ensure YouTube is always detached 9 | -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | # Checking for installation environment 2 | # Abort TWRP installation with error message when user tries to install this module in TWRP 3 | 4 | if [ $BOOTMODE = false ]; then 5 | ui_print "- Installing through TWRP Not supported" 6 | ui_print "- Intsall this module via Magisk Manager" 7 | abort "- Aborting installation !!" 8 | fi 9 | api_level_arch_detect 10 | 11 | MAGISKTMP="$(magisk --path)" || MAGISKTMP=/sbin 12 | 13 | PKGNAME="$(grep_prop package "$MODPATH/module.prop")" 14 | APPNAME="YouTube" 15 | STOCKAPPVER=$(dumpsys package $PKGNAME | grep versionName | cut -d= -f 2 | sed -n '1p') 16 | RVAPPVER="$(grep_prop version "$MODPATH/module.prop")" 17 | URL="https://www.apkmirror.com/apk/google-inc/youtube/youtube-$(echo -n "$RVAPPVER" | tr "." "-")-release/" 18 | 19 | 20 | if [ ! -d "/proc/1/root/data/data/$PKGNAME" ] 21 | then 22 | ui_print "- $APPNAME app is not installed" 23 | am start -a android.intent.action.VIEW -d "$URL" &>/dev/null 24 | abort "- Aborting installation !!" 25 | fi 26 | 27 | [ ! -d "$MAGISKTMP/.magisk/modules/magisk_proc_monitor" ] && { 28 | MURL=http://github.com/HuskyDG/magisk_proc_monitor 29 | ui_print "- Process monitor tool is not installed" 30 | ui_print " Please install it from $MURL" 31 | am start -a android.intent.action.VIEW -d "$MURL" &>/dev/null 32 | } 33 | 34 | 35 | if [ "$STOCKAPPVER" != "$RVAPPVER" ] 36 | then 37 | ui_print "- Installed $APPNAME version = $STOCKAPPVER" 38 | ui_print "- $APPNAME Revanced version = $RVAPPVER" 39 | ui_print "- App Version Mismatch !!" 40 | am start -a android.intent.action.VIEW -d "$URL" &>/dev/null 41 | abort "- Aborting installation !!" 42 | fi 43 | 44 | ui_print "- Install sqlite3 plug-in for detach" 45 | mkdir "$MODPATH/bin" 46 | unzip -oj "$MODPATH/sqlite3.zip" "$ABI/sqlite3" -d "$MODPATH/bin" &>/dev/null || abort "! Unzip failed" 47 | chmod 755 "$MODPATH/bin/sqlite3" 48 | rm -rf "$MODPATH/sqlite3.zip" 49 | 50 | # Disable battery optimization for YouTube ReVanced 51 | sleep 1 52 | ui_print "- Disable Battery Optimization for YouTube ReVanced" 53 | dumpsys deviceidle whitelist +$PKGNAME > /dev/null 2>&1 54 | 55 | 56 | ui_print "- Install Successful !!" 57 | -------------------------------------------------------------------------------- /detachyt.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Detach script - Disable Play store updates for YouTube ReVanced Extended 3 | 4 | export PATH="${0%/*}/bin:$PATH" 5 | 6 | . "${0%/*}/utils.sh" 7 | # Expansion 8 | LOG="${0%/*}/detach.log" 9 | PS=com.android.vending 10 | DB=/data/data/$PS/databases 11 | LDB=$DB/library.db 12 | LADB=$DB/localappstate.db 13 | GET_LDB=$(sqlite3 $LDB "SELECT doc_id,doc_type FROM ownership" | grep $PK | head -n 1 | grep -o 25) 14 | 15 | # Main script 16 | if [ "$GET_LDB" != "25" ]; then 17 | # Disable Play store 18 | cmd appops set --uid $PS GET_USAGE_STATS ignore 19 | 20 | # Update database 21 | sqlite3 $LDB "UPDATE ownership SET doc_type = '25' WHERE doc_id = '$PK'"; 22 | sqlite3 $LADB "UPDATE appstate SET auto_update = '2' WHERE package_name = '$PACKAGE_NAME'"; 23 | 24 | # Remove cache 25 | rm -rf /data/data/$PS/cache/* 26 | 27 | # Log 28 | echo "$(date) - YouTube ReVanced Extended successfully detached from play store" >> $LOG 29 | fi 30 | -------------------------------------------------------------------------------- /dynmount.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | MODDIR="${0%/*}" 3 | MODNAME="${MODDIR##*/}" 4 | 5 | # API_VERSION = 1 6 | STAGE="$1" # prepareEnterMntNs or EnterMntNs 7 | PID="$2" # PID of app process 8 | UID="$3" # UID oLbf app process 9 | PROC="$4" # Process name. Example: com.google.android.gms.unstable 10 | USERID="$5" # USER ID of app 11 | # API_VERSION = 2 12 | # Enable ash standalone 13 | # Enviroment variables: MAGISKTMP, API_VERSION 14 | 15 | TMPFILE="$MAGISKTMP/.magisk/modules/$MODNAME/module.prop" 16 | . "$MODDIR/utils.sh" 17 | 18 | RUN_SCRIPT(){ 19 | if [ "$STAGE" == "prepareEnterMntNs" ]; then 20 | prepareEnterMntNs 21 | elif [ "$STAGE" == "EnterMntNs" ]; then 22 | EnterMntNs 23 | fi 24 | } 25 | 26 | prepareEnterMntNs(){ 27 | # script run before enter the mount name space of app process 28 | 29 | if [ "$API_VERSION" -lt 2 ]; then 30 | # Need API 2 and newer 31 | exit 1 32 | fi 33 | 34 | if [ "$PROC" == "com.android.vending" ]; then 35 | // hack 36 | exit 0 37 | fi 38 | 39 | if [ "$PROC" == "$PACKAGE_NAME" ] || [ "$UID" -lt 10000 ] || [ "$PROC" == "com.android.systemui" ]; then 40 | touch "$MODDIR/loaded" 41 | STOCKAPPVER=$(dumpsys package $PACKAGE_NAME | grep versionName | cut -d= -f 2 | sed -n '1p') 42 | RVAPPVER=$(grep_prop version "$MODDIR/module.prop") 43 | check_version || exit 1 44 | W=$(sed -E 's/^description=(\[.*][[:space:]]*)?/description=[ 😋 Dynamic mount is working. ] /g' "$MODDIR/module.prop") 45 | echo -n "$W" >"$TMPFILE" 46 | exit 0 47 | fi 48 | 49 | #exit 0 # allow script to run in EnterMntNs stage 50 | exit 1 # close script and don't allow script to run in EnterMntNs stage 51 | } 52 | 53 | 54 | EnterMntNs(){ 55 | # script run after enter the mount name space of app process and you allow this script to run in EnterMntNs stage 56 | 57 | if [ "$PROC" == "com.android.vending" ]; then 58 | . "$MODDIR/detachyt.sh" 59 | exit 1 60 | fi 61 | 62 | . "$MODDIR/mount.sh" 63 | exit 1 64 | } 65 | 66 | RUN_SCRIPT -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=ytrevancedinject 2 | name=YouTube ReVanced 3 | package=com.google.android.youtube 4 | version=18.01.36 5 | versionCode=4 6 | author=HuskyDG 7 | description=YouTube ReVanced repacked by HuskyDG. Require Magisk Process Monitor tool v2.1+ for Dynamic Mount -------------------------------------------------------------------------------- /mount.sh: -------------------------------------------------------------------------------- 1 | . "$MODDIR/utils.sh" 2 | PACKAGE_NAME="$(grep_prop package "$MODDIR/module.prop")" 3 | base_path="$MODDIR/revanced.apk" 4 | stock_path=$(pm path $PACKAGE_NAME | head -1 | sed 's/^package://g' ) 5 | if [ -z "$stock_path" ]; then exit 0; fi 6 | chcon u:object_r:magisk_file:s0 "$base_path" 7 | chmod 0755 "$base_path" 8 | mount -o bind "$base_path" "$stock_path" -------------------------------------------------------------------------------- /post-fs-data.sh: -------------------------------------------------------------------------------- 1 | MODDIR="${0%/*}" 2 | MODNAME="${MODDIR##*/}" 3 | MAGISKTMP="$(magisk --path)" || MAGISKTMP=/sbin 4 | 5 | PROPFILE="$MAGISKTMP/.magisk/modules/$MODNAME/module.prop" 6 | TMPFILE="$MAGISKTMP/revanced.prop" 7 | cp -af "$MODDIR/module.prop" "$TMPFILE" 8 | 9 | sed -Ei 's/^description=(\[.*][[:space:]]*)?/description=[ ⛔ Module is not working. ] /g' "$TMPFILE" 10 | flock "$MODDIR/module.prop" 11 | 12 | mount --bind "$TMPFILE" "$PROPFILE" 13 | 14 | rm -rf "$MODDIR/loaded" 15 | exit 0 -------------------------------------------------------------------------------- /revanced.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/ytrevancedinject/7122db5a875d01734218114269c2282a8be2eeb2/revanced.apk -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | while [ "$(resetprop sys.boot_completed)" != 1 ]; do 2 | sleep 1 3 | done 4 | sleep 1 5 | MODDIR="${0%/*}" 6 | MODNAME="${MODDIR##*/}" 7 | sh "$MODPATH/detachyt.sh" 8 | MAGISKTMP="$(magisk --path)" || MAGISKTMP=/sbin 9 | TMPFILE="$MAGISKTMP/.magisk/modules/$MODNAME/module.prop" 10 | . "$MODDIR/utils.sh" 11 | [ -e "$MODDIR/loaded" ] || { check_version && . "$MODDIR/mount.sh"; } || exit 0 12 | 13 | W=$(sed -E 's/^description=(\[.*][[:space:]]*)?/description=[ 😅 File is mounted globally because Dynamic mount is not working. ] /g' "$MODDIR/module.prop") 14 | echo -n "$W" >"$TMPFILE" -------------------------------------------------------------------------------- /sqlite3.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/ytrevancedinject/7122db5a875d01734218114269c2282a8be2eeb2/sqlite3.zip -------------------------------------------------------------------------------- /utils.sh: -------------------------------------------------------------------------------- 1 | grep_prop() { 2 | local REGEX="s/^$1=//p" 3 | shift 4 | local FILES=$@ 5 | [ -z "$FILES" ] && FILES='/system/build.prop' 6 | cat $FILES 2>/dev/null | dos2unix | sed -n "$REGEX" | head -n 1 7 | } 8 | 9 | check_version(){ 10 | STOCKAPPVER=$(dumpsys package $PACKAGE_NAME | grep versionName | cut -d= -f 2 | sed -n '1p') 11 | RVAPPVER=$(grep_prop version "$MODDIR/module.prop") 12 | if [ "$STOCKAPPVER" != "$RVAPPVER" ]; then 13 | W=$(sed -E 's/^description=(\[.*][[:space:]]*)?/description=[ ❌ The current version of YouTube does not match. ] /g' "$MODDIR/module.prop") 14 | echo -n "$W" >"$TMPFILE" 15 | return 1 16 | fi 17 | return 0 18 | } 19 | 20 | PACKAGE_NAME=$(grep_prop package "$MODDIR/module.prop") --------------------------------------------------------------------------------