mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-19 23:05:19 +05:30
Add: revanced
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,5 +33,4 @@ token
|
||||
.shortcuts
|
||||
BB90-191C
|
||||
temp*
|
||||
revanced*
|
||||
sh-dlp
|
||||
|
||||
4
ani-new
4
ani-new
@@ -21,7 +21,7 @@ decrypt_allanime() {
|
||||
printf "%s" "$-" | grep -q 'x' && set +x
|
||||
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
|
||||
dec=$(printf '%d' "0x$hex")
|
||||
xor=$((dec ^ 48))
|
||||
xor=$((dec ^ 56))
|
||||
oct=$(printf "%03o" "$xor")
|
||||
#shellcheck disable=SC2059
|
||||
printf "\\$oct"
|
||||
@@ -75,7 +75,7 @@ ep_no=$(printf "%s" "$url" | sed 's/.*Episode //g')
|
||||
|
||||
info_$os "Loading Episode $title.."
|
||||
episode_embed_gql="query (\$showId: String!, \$translationType: VaildTranslationTypeEnumType!, \$episodeString: String!) { episode( showId: \$showId translationType: \$translationType episodeString: \$episodeString ) { episodeString sourceUrls }}"
|
||||
data=$(curl -e https://allanime.to -sL --cipher AES256-SHA256 -G "{$base_url}/api" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"sub\",\"countryOrigin\":\"ALL\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A 'Mozilla/5.0 (Windows NT 6.1; Win64; rv:109.0) Gecko/20100101 Firefox/109.0' | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"##([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
|
||||
data=$(curl -e https://allanime.to -sL --cipher AES256-SHA256 -G "{$base_url}/api" --data-urlencode "variables={\"showId\":\"$id\",\"translationType\":\"sub\",\"countryOrigin\":\"ALL\",\"episodeString\":\"$ep_no\"}" --data-urlencode "query=$episode_embed_gql" -A 'Mozilla/5.0 (Windows NT 6.1; Win64; rv:109.0) Gecko/20100101 Firefox/109.0' | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"--([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
|
||||
info_$os "Fetching Embed links"
|
||||
|
||||
#dropbox links
|
||||
|
||||
93
revanced
Executable file
93
revanced
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
info(){
|
||||
printf "\033[1;35m=> \033[1;${2:-36}m%s\033[0m\n" "$1"
|
||||
}
|
||||
|
||||
download_apk(){
|
||||
[ -z "$1" ] && info "[ $app ][ v$version ] Version doesn't Exist!" "31" && exit 1
|
||||
info "[ $app ][ v$version ] Fetching Download page.."
|
||||
final_page=$(curl -s "${apk_provider_url}${1}" --tlsv1.3 -A "$agent" | sed -nE 's|.*href="(.*\/download\/[^"]*)".*|\1|p' | sed 's|&|\&|g')
|
||||
[ -z "$final_page" ] && info "[ $app ][ v$version ] Unable to Fetch Download Page.." "31" && exit 1
|
||||
info "[ $app ][ v$version ] Fetching Download URL.."
|
||||
download_url=$(curl -s "${apk_provider_url}${final_page}" --tlsv1.3 -A "$agent" | sed -nE 's|.*href="(.*download.php[^"]*)".*|\1|p' | sed 's|&|\&|g')
|
||||
[ -z "$download_url" ] && info "[ $app ][ v$version ] Unable to Fetch Download URL.." "31" && exit 1
|
||||
info "[ $app ][ v$version ] Downloading App.."
|
||||
aria2c -x16 -s16 "${apk_provider_url}${download_url}" --user-agent="$agent" -d "$tmp_dir" -o "$app-$version.apk" --allow-overwrite=true --check-certificate=false --download-result=hide --summary-interval=0 && info "[ $app ][ v$version ] App Downloaded.." && return 0
|
||||
info "[ $app ][ v$version ] Unable to Download.." "31"
|
||||
}
|
||||
|
||||
tmp_dir="/tmp/revanced"
|
||||
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
|
||||
apk_provider_url="https://www.apkmirror.com"
|
||||
date=$(date +%F)
|
||||
rv_cli="cli-$date.jar"
|
||||
rv_patch="patches-$date.jar"
|
||||
rv_inte="integrations-$date.apk"
|
||||
|
||||
#check if directory is there
|
||||
[ -d "$tmp_dir" ] || mkdir "$tmp_dir"
|
||||
|
||||
#pre-requisite
|
||||
if [ ! -f "$tmp_dir/$rv_cli" ] || [ ! -f "$tmp_dir/$rv_patch" ] || [ ! -f "$tmp_dir/$rv_inte" ];then
|
||||
info "Downloading revanced-cli,revanced-patches,revanced-integrations.."
|
||||
printf "%s\n%s\n%s" "$(curl -s "https://api.github.com/repos/revanced/revanced-cli/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.jar)\"|\1\n\tout=$rv_cli|p")" "$(curl -s "https://api.github.com/repos/revanced/revanced-patches/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.jar)\"|\1\n\tout=$rv_patch|p")" "$(curl -s "https://api.github.com/repos/revanced/revanced-integrations/releases/latest" -L -A "$agent" | sed -nE "s|.*browser_download_url\": \"([^\"]*.apk)\"|\1\n\tout=$rv_inte|p")" | aria2c -j3 -x16 -s16 -i - --check-certificate=false --download-result=hide --summary-interval=0 --allow-overwrite=true -d "$tmp_dir" && info "Downloaded revanced-cli,revanced-patches,revanced-integrations at $tmp_dir"
|
||||
else
|
||||
info "revanced-cli,revanced-patches,revanced-integrations already downloaded" "32"
|
||||
fi
|
||||
|
||||
#choose your app
|
||||
[ -z "$1" ] && app=$(printf "youtube\nyoutube-music" | fzf --prompt="Select Application:" --layout=reverse --height=8 --border) || app=$1
|
||||
|
||||
[ -z "$app" ] && exit 0
|
||||
|
||||
#set variables according to selected app
|
||||
case $app in
|
||||
youtube)
|
||||
arch="universal"
|
||||
version=$(curl -s "https://api.revanced.app/v2/patches/latest" | sed -nE 's|.*"compatiblePackages":\[\{"name":"com.google.android.youtube","versions":\[(.*[^\]]).*|\1|p' | tr -d ']}"' | tr ',' '\n' | tail -1 | tr '.' '-')
|
||||
exclude_patch_list="always-autorepeat,disable-auto-captions,disable-zoom-haptics,enable-debugging,external-downloads,hide-autoplay-button,hide-captions-button,hide-cast-button,hide-floating-microphone-button,hide-layout-components,hide-load-more-button,hide-player-buttons,hide-player-overlay,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls"
|
||||
out="yt-revanced-$version.apk"
|
||||
;;
|
||||
youtube-music)
|
||||
arch="arm64-v8a"
|
||||
[ -z "$2" ] && version="6-10-53" || version=$2
|
||||
exclude_patch_list="dummy-patch"
|
||||
out="yt-music-revanced-$version.apk"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ];then
|
||||
info "Latest Recommended $app v$version already downloaded" "32"
|
||||
else
|
||||
info "[ $app ][ v$version ] Fetching App.."
|
||||
download_apk "$(curl -s "$apk_provider_url/apk/google-inc/$app/$app-$version-release/" -A "$agent" --tlsv1.3 | tr -d '\n' | sed 's|svg class|\n|g' | sed -nE "s|.*$arch.*nodpi.*accent_color\" href=\"([^\"]*)\".*|\1|p")"
|
||||
fi
|
||||
|
||||
info "Checking Patches for excluding.."
|
||||
patch_list=$(java -jar "$tmp_dir/$rv_cli" -b "$tmp_dir/$rv_patch" -a "$tmp_dir/$app-$version.apk" -l --with-packages)
|
||||
|
||||
if [ -n "$exclude_patch_list" ];then
|
||||
info "Excluding Patches.." "33"
|
||||
for i in $(printf "%s" "$exclude_patch_list" | tr ',' '\n');do
|
||||
if printf "%s" "$patch_list" | grep -q "$i";then
|
||||
res="32m ✓"
|
||||
else
|
||||
res="31m "
|
||||
check=1
|
||||
fi
|
||||
printf "\033[2K\r\033[1;%s %s\n" "$res" "$i"
|
||||
done
|
||||
exclude_patches=$(printf "%s" "$exclude_patch_list" | tr ',' '\n' | sed 's|^|-e |g' | tr '\n' ' ')
|
||||
else
|
||||
info "Nothing to Exclude.." "32"
|
||||
fi
|
||||
|
||||
[ -n "$check" ] && info "Some of the patches are not Excluded,Check all failed patches using :" "31" && info "java -jar '$tmp_dir/$rv_cli' -b '$tmp_dir/$rv_patch' -a '$tmp_dir/$app-$version.apk' -l --with-packages" "33" && exit 1
|
||||
info "All listed Patches Excluded"
|
||||
|
||||
info "Patching $app-$version.apk.."
|
||||
|
||||
#shellcheck disable=SC2086
|
||||
java -jar "$tmp_dir/$rv_cli" -a "$tmp_dir/$app-$version.apk" -b "$tmp_dir/$rv_patch" -m "$tmp_dir/$rv_inte" -o "$HOME/$out" --temp-dir="$tmp_dir/build" $exclude_patches
|
||||
Reference in New Issue
Block a user