This commit is contained in:
FiorenMas
2023-04-11 23:43:37 +07:00
parent c705770d5c
commit 226f05bc82
5 changed files with 172 additions and 10 deletions

View File

@@ -26,19 +26,36 @@ jobs:
| cut -d : -f 2,3 \ | cut -d : -f 2,3 \
| tr -d \" \ | tr -d \" \
| wget -qi - | wget -qi -
RVVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json) YT-RVVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json)
rm -rf patches.json rm -rf patches.json
curl -s https://api.github.com/repos/inotia00/revanced-patches/releases/latest \ curl -s https://api.github.com/repos/inotia00/revanced-patches/releases/latest \
| grep "browser_download_url.*json" \ | grep "browser_download_url.*json" \
| cut -d : -f 2,3 \ | cut -d : -f 2,3 \
| tr -d \" \ | tr -d \" \
| wget -qi - | wget -qi -
RVEVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json) YT-RVEVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.youtube") | .versions[-1]' patches.json)
rm -rf patches.json rm -rf patches.json
curl -s https://api.github.com/repos/revanced/revanced-patches/releases/latest \
| grep "browser_download_url.*json" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
YTM-RVVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.apps.youtube.music") | .versions[-1]' patches.json)
rm -rf patches.json
curl -s https://api.github.com/repos/inotia00/revanced-patches/releases/latest \
| grep "browser_download_url.*json" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
YTM-RVEVERSION=$(jq -r '.[] | select(.name == "microg-support") | .compatiblePackages[] | select(.name == "com.google.android.apps.youtube.music") | .versions[-1]' patches.json)
rm -rf patches.json
echo "Download Below :point_down:" > ${{ github.workspace }}-CHANGELOG.txt echo "Download Below :point_down:" > ${{ github.workspace }}-CHANGELOG.txt
echo "INFO-RV=Revanced-v${RVVERSION}" >> $GITHUB_ENV echo "INFO-YT-RV=Youtube-Revanced-v${YT-RVVERSION}" >> $GITHUB_ENV
echo "INFO-RVE=Revanced Extended-v${RVEVERSION}" >> $GITHUB_ENV echo "INFO-YT-RVE=Youtube-Revanced Extended-v${YT-RVEVERSION}" >> $GITHUB_ENV
echo "INFO-YTM-RV=Youtube-Revanced-v${YTM-RVVERSION}" >> $GITHUB_ENV
echo "INFO-YTM-RVE=Youtube-Revanced Extended-v${YTM-RVEVERSION}" >> $GITHUB_ENV
- uses: vishnudxb/cancel-workflow@v1.2 - uses: vishnudxb/cancel-workflow@v1.2
if: failure() if: failure()
@@ -59,8 +76,8 @@ jobs:
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: yt-revanced.apk files: yt-revanced.apk
name: ${{ env.INFO-RV }} name: ${{ env.INFO-YT-RV }}
tag_name: Revanced tag_name: YT-Revanced
body_path: ${{ github.workspace }}-CHANGELOG.txt body_path: ${{ github.workspace }}-CHANGELOG.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -69,8 +86,28 @@ jobs:
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
files: yt-revanced-extended.apk files: yt-revanced-extended.apk
name: ${{ env.INFO-RVE }} name: ${{ env.INFO-YT-RVE }}
tag_name: Revanced-Extended tag_name: YT-Revanced-Extended
body_path: ${{ github.workspace }}-CHANGELOG.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Youtube Music Revanced
uses: softprops/action-gh-release@v1
with:
files: yt-revanced.apk
name: ${{ env.INFO-YTM-RV }}
tag_name: YT-Revanced
body_path: ${{ github.workspace }}-CHANGELOG.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release Youtube Music Revanced Extended
uses: softprops/action-gh-release@v1
with:
files: yt-revanced-extended.apk
name: ${{ env.INFO-YTM-RVE }}
tag_name: YT-Revanced-Extended
body_path: ${{ github.workspace }}-CHANGELOG.txt body_path: ${{ github.workspace }}-CHANGELOG.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

BIN
ytm/ks.keystore Normal file

Binary file not shown.

103
ytm/patch-ytm.sh Normal file
View File

@@ -0,0 +1,103 @@
`#!/bin/bash
set -e
# Set variables for Revanced
readonly revanced_name="revanced"
readonly revanced_user="revanced"
readonly revanced_patch="patches.rv"
readonly revanced_ytmsversion="" # Input version supported if you need patch specific YT version.Example: "18.03.36"
# Set variables for Revanced Extended
readonly revanced_extended_name="revanced-extended"
readonly revanced_extended_user="inotia00"
readonly revanced_extended_patch="patches.rve"
readonly revanced_extended_ytmsversion="" # Input version supported if you need patch specific YT version.Example: "18.07.35"
# Function prepare patches keywords
get_patch() {
local excluded_start=$(grep -n -m1 'EXCLUDE PATCHES' "$patch_file" | cut -d':' -f1)
local included_start=$(grep -n -m1 'INCLUDE PATCHES' "$patch_file" | cut -d':' -f1)
local excluded_patches=$(tail -n +$excluded_start $patch_file | head -n "$(( included_start - excluded_start ))" | grep '^[^#[:blank:]]')
local included_patches=$(tail -n +$included_start $patch_file | grep '^[^#[:blank:]]')
patches=()
if [[ -n "$excluded_patches" ]]; then
while read -r patch; do
patches+=("-e $patch")
done <<< "$excluded_patches"
fi
if [[ -n "$included_patches" ]]; then
while read -r patch; do
patches+=("-i $patch")
done <<< "$included_patches"
fi
}
# Function download latest github releases
download_latest_release() {
echo "⏬ Downloading $name resources..."
for repos in revanced-patches revanced-cli revanced-integrations; do
local url="https://api.github.com/repos/$user/$repos/releases/latest"
curl -s "$url" | jq -r '.assets[].browser_download_url' | xargs -n 1 curl -O -s -L
done
}
# Function download YouTube apk from APKmirror
req() {
curl -sSL -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:111.0) Gecko/20100101 Firefox/111.0" "$1" -o "$2"
}
dl_ytm() {
rm -rf $2
echo "Downloading YouTubeMusic $1"
url="https://www.apkmirror.com/apk/google-inc/youtube/youtube-music-${1//./-}-release/"
url="$url$(req "$url" - | grep arm64 -A30 | grep youtube-music | head -1 | sed "s#.*-release/##g;s#/\".*##g")"
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
url="https://www.apkmirror.com$(req "$url" - | tr '\n' ' ' | sed -n 's;.*href="\(.*key=[^"]*\)">.*;\1;p')"
req "$url" "$2"
}
get_latestytmversion() {
url="https://www.apkmirror.com/apk/google-inc/youtube-music/"
ytmsversion=$(req "$url" - | grep "All version" -A200 | grep app_release | sed 's:.*/youtube-music-::g;s:-release/.*::g;s:-:.:g' | sort -r | head -1)
echo "Latest YoutubeMusic Version: $ytmsversion"
}
get_support_version() {
ytmsversion=$(jq -r '.[] | select(.name == "hide-get-premium") | .compatiblePackages[] | select(.name == "com.google.android.apps.youtube.music") | .versions[-1]' patches.json)
}
# Function Patch APK
patch_apk() {
echo "⚙️ Patching YouTube..."
java -jar revanced-cli*.jar \
-m revanced-integrations*.apk \
-b revanced-patches*.jar \
-a youtube-music-v$ytmsversion.apk \
${patches[@]} \
--keystore=ks.keystore \
-o ytms-$name.apk
}
# Function clean caches to new build
clean_cache() {
echo "🧹 Clean caches..."
rm -f revanced-cli*.jar \
revanced-integrations*.apk \
revanced-patches*.jar \
patches.json \
options.toml \
youtube*.apk \
}
# Loop over Revanced & Revanced Extended
for name in $revanced_name $revanced_extended_name ; do
# Select variables based on name
if [[ "$name" = "$revanced_name" ]]; then
user="$revanced_user"
patch_file="$revanced_patch"
ytmsversion="$revanced_ytmsversion"
else
user="$revanced_extended_user"
patch_file="$revanced_extended_patch"
ytmsversion="$revanced_extended_ytmsversion"
fi
get_patch
download_latest_release
if [[ "$name" = "$revanced_name" ]] ; then
get_support_version
dl_ytm $ytmsversion youtube-music-v$ytmsversion.apk
else get_latestytmversion
dl_ytm $ytmsversion youtube-music-v$ytmsversion.apk
fi
patch_apk
clean_cache
done`

11
ytm/patches-ytm.rv Normal file
View File

@@ -0,0 +1,11 @@
# EXCLUDE PATCHES FROM BELOW
compact-header
# INCLUDE PATCHES FROM BELOW
background-play
codecs-unlock
exclusive-audio-playback
hide-get-premium
minimized-playback-music
music-video-ads
tasteBuilder-remover
upgrade-button-remover

11
ytm/patches-ytm.rve Normal file
View File

@@ -0,0 +1,11 @@
# EXCLUDE PATCHES FROM BELOW
compact-header
# INCLUDE PATCHES FROM BELOW
background-play
codecs-unlock
exclusive-audio-playback
hide-get-premium
minimized-playback-music
music-video-ads
tasteBuilder-remover
upgrade-button-remover