Advertisement
Guest User

Untitled

a guest
Sep 15th, 2022
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. #!/bin/bash
  2. #【R.I.P】非公式YouTubeアプリ総合スレ7【Vanced】#
  3.  
  4. echo "(first arg)custum aapt2 path: $1"
  5.  
  6. TIMESTAMP=`date "+%Y%m%d%H%M"`
  7.  
  8. WORKSPACE="$HOME/.revanced"
  9. 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"
  10.  
  11. AAPT2_ARGS=""
  12. if [ -n "$1" ]; then
  13. AAPT2_ARGS="--custom-aapt2-binary $1"
  14. fi
  15.  
  16. rm -rf $WORKSPACE/revanced-cache/
  17. rm -rf revanced-cache/
  18. rm -rf $HOME/.local/share/apktool/
  19.  
  20. if [ ! -e "$WORKSPACE" ]; then
  21. mkdir -p $WORKSPACE
  22. fi
  23.  
  24. # Check if curl is installed before continuing
  25. if ! command -v "curl" &> "/dev/null"; then
  26. echo
  27. echo -e "\e[1;31mError: curl not found\e[0m"
  28. echo
  29. exit 1
  30. fi
  31.  
  32. CURL_HEADER="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"
  33.  
  34. CLI_VERSION="$(curl -s -H "$CURL_HEADER" https://api.github.com/repos/revanced/revanced-cli/releases/latest | grep "tag_name")"
  35. CLI_VERSION="${CLI_VERSION:16:-2}"
  36. echo "revanced-cli --version: $CLI_VERSION"
  37. CLI_PATH="$WORKSPACE/revanced-cli-$CLI_VERSION-all.jar"
  38. 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
  39. #if [ ! $? == 0 ]; then exit 1; fi
  40.  
  41. INTEGRATIONS_VERSION="$(curl -s https://api.github.com/repos/revanced/revanced-integrations/releases/latest | grep "tag_name")"
  42. INTEGRATIONS_VERSION="${INTEGRATIONS_VERSION:16:-2}"
  43. echo "revanced-integrations --version: $INTEGRATIONS_VERSION"
  44. INTEGRATIONS_PATH="$WORKSPACE/revanced-integrations-$INTEGRATIONS_VERSION.apk"
  45. 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
  46. #if [ ! $? == 0 ]; then exit 1; fi
  47.  
  48. PATCHES_VERSION="$(curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest | grep "tag_name")"
  49. PATCHES_VERSION="${PATCHES_VERSION:16:-2}"
  50. echo "revanced-patches --version: $PATCHES_VERSION"
  51. PATCHES_PATH="$WORKSPACE/revanced-patches-$PATCHES_VERSION.jar"
  52. 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
  53. #if [ ! $? == 0 ]; then exit 1; fi
  54.  
  55. SUPPORTED_VERSIONS=$(unzip -p $PATCHES_PATH | strings -n 8 -s , | sed -rn 's/.*youtube,versions,(([0-9.]*,*)*),Lk.*/\1/p')
  56. echo "Supported versions of the patch: $SUPPORTED_VERSIONS"
  57. YOUTUBE_VERSION=$(echo $SUPPORTED_VERSIONS | awk -F, '{ print $NF }')
  58. echo "youtube-apkm --version: $YOUTUBE_VERSION"
  59. APKM_PATH="$WORKSPACE/youtube-$YOUTUBE_VERSION.apkm"
  60.  
  61. if [ ! -f "$APKM_PATH" ]; then
  62. APKMIRROR_URL="https://www.apkmirror.com/apk/google-inc/youtube/youtube-${YOUTUBE_VERSION//./-}-release/"
  63. 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')"
  64. echo "downloaded from: $APKMIRROR_URL"
  65. APKMIRROR_URL="https://www.apkmirror.com$(curl $APKMIRROR_URL -fsSL -H "$CURL_HEADER" | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
  66. APKMIRROR_URL="https://www.apkmirror.com$(curl $APKMIRROR_URL -fsSL -H "$CURL_HEADER" | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
  67. curl $APKMIRROR_URL -sSL -H "$CURL_HEADER" -o "$APKM_PATH"
  68. fi
  69. #if [ ! $? == 0 ]; then exit 1; fi
  70.  
  71. APKM_CACHE_DIR="$WORKSPACE/youtube-apkm-cache"
  72. APK_PATH="$APKM_PATH.base.apk"
  73.  
  74. rm -rf $APKM_CACHE_DIR
  75. unzip -o -d $APKM_CACHE_DIR $APKM_PATH base.apk
  76. cp $APKM_CACHE_DIR/base.apk $APK_PATH
  77.  
  78. OUTPUT_PATH="$APK_PATH.revanced-$TIMESTAMP.apk"
  79.  
  80. CLI_COMMAND_ARGS="-jar $CLI_PATH -a $APK_PATH -o $OUTPUT_PATH -b $PATCHES_PATH -m $INTEGRATIONS_PATH --mount $PATCHES_ARGS $AAPT2_ARGS"
  81.  
  82. echo
  83. echo "Command: java"
  84. echo $CLI_COMMAND_ARGS
  85. echo
  86.  
  87. java $CLI_COMMAND_ARGS
  88.  
  89. echo "Copying $OUTPUT_PATH to $WORKSPACE/yt_rv.apk"
  90. cp -f $OUTPUT_PATH "$WORKSPACE/yt_rv.apk"
  91. chmod 644 "$WORKSPACE/yt_rv.apk"
  92.  
  93. rm -rf $WORKSPACE/revanced-cache/
  94. rm -rf revanced-cache/
  95. rm -rf $HOME/.local/share/apktool/
  96. rm -rf $APKM_CACHE_DIR
  97.  
  98. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement