Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #【R.I.P】非公式YouTubeアプリ総合スレ7【Vanced】#
- echo "(first arg)custum aapt2 path: $1"
- TIMESTAMP=`date "+%Y%m%d%H%M"`
- WORKSPACE="$HOME/.revanced"
- PATCHES_ARGS="-e custom-branding -e microg-support -e return-youtube-dislike -e sponsorblock -e amoled -e downloads -e premium-heading -e swipe-controls -e seekbar-tapping -e disable-fullscreen-panels -e enable-wide-searchbar -e tablet-mini-player -e custom-video-buffer -e hdr-auto-brightness"
- AAPT2_ARGS=""
- if [ -n "$1" ]; then
- AAPT2_ARGS="--custom-aapt2-binary $1"
- fi
- rm -rf $WORKSPACE/revanced-cache/
- rm -rf revanced-cache/
- rm -rf $HOME/.local/share/apktool/
- if [ ! -e "$WORKSPACE" ]; then
- mkdir -p $WORKSPACE
- fi
- # Check if curl is installed before continuing
- if ! command -v "curl" &> "/dev/null"; then
- echo
- echo -e "\e[1;31mError: curl not found\e[0m"
- echo
- exit 1
- fi
- CURL_HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"
- CLI_VERSION="$(curl -s -H "$CURL_HEADER" https://api.github.com/repos/revanced/revanced-cli/releases/latest | grep "tag_name")"
- CLI_VERSION="${CLI_VERSION:16:-2}"
- echo "revanced-cli --version: $CLI_VERSION"
- CLI_PATH="$WORKSPACE/revanced-cli-$CLI_VERSION-all.jar"
- if [ ! -f "$CLI_PATH" ]; then curl "https://github.com/revanced/revanced-cli/releases/download/v$CLI_VERSION/revanced-cli-$CLI_VERSION-all.jar" -sSL -o "$CLI_PATH"; fi
- #if [ ! $? == 0 ]; then exit 1; fi
- INTEGRATIONS_VERSION="$(curl -s https://api.github.com/repos/revanced/revanced-integrations/releases/latest | grep "tag_name")"
- INTEGRATIONS_VERSION="${INTEGRATIONS_VERSION:16:-2}"
- echo "revanced-integrations --version: $INTEGRATIONS_VERSION"
- INTEGRATIONS_PATH="$WORKSPACE/revanced-integrations-$INTEGRATIONS_VERSION.apk"
- if [ ! -f "$INTEGRATIONS_PATH" ]; then curl "https://github.com/revanced/revanced-integrations/releases/download/v$INTEGRATIONS_VERSION/app-release-unsigned.apk" -sSL -o "$INTEGRATIONS_PATH"; fi
- #if [ ! $? == 0 ]; then exit 1; fi
- PATCHES_VERSION="$(curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest | grep "tag_name")"
- PATCHES_VERSION="${PATCHES_VERSION:16:-2}"
- echo "revanced-patches --version: $PATCHES_VERSION"
- PATCHES_PATH="$WORKSPACE/revanced-patches-$PATCHES_VERSION.jar"
- if [ ! -f "$PATCHES_VERSION" ]; then curl "https://github.com/revanced/revanced-patches/releases/download/v$PATCHES_VERSION/revanced-patches-$PATCHES_VERSION.jar" -sSL -o "$PATCHES_PATH"; fi
- #if [ ! $? == 0 ]; then exit 1; fi
- SUPPORTED_VERSIONS=$(unzip -p $PATCHES_PATH | strings -n 8 -s , | sed -rn 's/.*youtube,versions,(([0-9.]*,*)*),Lk.*/\1/p')
- echo "Supported versions of the patch: $SUPPORTED_VERSIONS"
- YOUTUBE_VERSION=$(echo $SUPPORTED_VERSIONS | awk -F, '{ print $NF }')
- echo "youtube-apkm --version: $YOUTUBE_VERSION"
- APKM_PATH="$WORKSPACE/youtube-$YOUTUBE_VERSION.apkm"
- if [ ! -f "$APKM_PATH" ]; then
- APKMIRROR_URL="https://www.apkmirror.com/apk/google-inc/youtube/youtube-${YOUTUBE_VERSION//./-}-release/"
- APKMIRROR_URL="https://www.apkmirror.com$(curl $APKMIRROR_URL -fsSL -H "$CURL_HEADER" | tr '\n' ' ' | sed -n 's/href="/@/g; s;.*BUNDLE</span>[^@]*@\([^#]*\).*;\1;p')"
- echo "downloaded from: $APKMIRROR_URL"
- APKMIRROR_URL="https://www.apkmirror.com$(curl $APKMIRROR_URL -fsSL -H "$CURL_HEADER" | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
- APKMIRROR_URL="https://www.apkmirror.com$(curl $APKMIRROR_URL -fsSL -H "$CURL_HEADER" | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
- curl $APKMIRROR_URL -sSL -H "$CURL_HEADER" -o "$APKM_PATH"
- fi
- #if [ ! $? == 0 ]; then exit 1; fi
- APKM_CACHE_DIR="$WORKSPACE/youtube-apkm-cache"
- APK_PATH="$APKM_PATH.base.apk"
- rm -rf $APKM_CACHE_DIR
- unzip -o -d $APKM_CACHE_DIR $APKM_PATH base.apk
- cp $APKM_CACHE_DIR/base.apk $APK_PATH
- OUTPUT_PATH="$APK_PATH.revanced-$TIMESTAMP.apk"
- CLI_COMMAND_ARGS="-jar $CLI_PATH -a $APK_PATH -o $OUTPUT_PATH -b $PATCHES_PATH -m $INTEGRATIONS_PATH --mount $PATCHES_ARGS $AAPT2_ARGS"
- echo
- echo "Command: java"
- echo $CLI_COMMAND_ARGS
- echo
- java $CLI_COMMAND_ARGS
- echo "Copying $OUTPUT_PATH to $WORKSPACE/yt_rv.apk"
- cp -f $OUTPUT_PATH "$WORKSPACE/yt_rv.apk"
- chmod 644 "$WORKSPACE/yt_rv.apk"
- rm -rf $WORKSPACE/revanced-cache/
- rm -rf revanced-cache/
- rm -rf $HOME/.local/share/apktool/
- rm -rf $APKM_CACHE_DIR
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement