mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
Never before had a small typo like this one caused so much damage.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#shellcheck disable=SC2086
|
||||
|
||||
menu_droid() {
|
||||
fzf --prompt="$1" $2
|
||||
}
|
||||
@@ -14,6 +16,7 @@ search_droid() {
|
||||
|
||||
search_linux() {
|
||||
query=$(: | menu_linux "$1 ")
|
||||
export query
|
||||
}
|
||||
|
||||
torrent_linux() {
|
||||
|
||||
24
ani-new
24
ani-new
@@ -30,7 +30,7 @@ case $(uname -o) in
|
||||
*)
|
||||
os="linux"
|
||||
download_dir="$HOME/Downloads"
|
||||
terminal="${TERMINAL:-foot} -e"
|
||||
[ -t 1 ] || terminal="${TERMINAL:-foot} -e"
|
||||
script_dir="$HOME/repos_scripts"
|
||||
;;
|
||||
esac
|
||||
@@ -49,6 +49,8 @@ printf "%s\n" "$url" | while read -r id title; do
|
||||
ep_no=$(printf "%s" "$title" | sed 's/.*Episode //g')
|
||||
|
||||
info_$os "Loading Episode $title.."
|
||||
[ -n "$debug" ] && printf "\n\033[1;36m title\033[0m : %s\n" "$title"
|
||||
|
||||
#shellcheck disable=SC2016
|
||||
data=$(allanime_curl "variables={\"showId\":\"$id\",\"translationType\":\"sub\",\"countryOrigin\":\"ALL\",\"episodeString\":\"$ep_no\"}" 'query=query ($showId: String!, $translationType: VaildTranslationTypeEnumType!, $episodeString: String!) { episode( showId: $showId translationType: $translationType episodeString: $episodeString ) { episodeString sourceUrls }}' | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"--([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
|
||||
info_$os "Fetching Embed links"
|
||||
@@ -56,21 +58,23 @@ printf "%s\n" "$url" | while read -r id title; do
|
||||
printf 'dropbox\tSak\nwetransfer\tKir\nsharepoint\tS-mp4\ngogoplay\tLuf-mp4\n' | while read -r provider_name provider_regex; do
|
||||
info_$os "Fetching $provider_name links"
|
||||
provider_id="$(decrypt_allanime "$(printf "%s" "$data" | sed -n "/$provider_regex :/p" | head -1 | cut -d':' -f2)" | sed "s/\/clock/\/clock\.json/")"
|
||||
[ -z "$provider_id" ] && return 0
|
||||
[ -z "$provider_id" ] && continue
|
||||
provider_video=$(curl -s "https://${domain}${provider_id}" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p' | head -1)
|
||||
[ -z "$provider_video" ] && return 0
|
||||
[ -n "$debug" ] && printf "\033[1;32m %s\033[0m : %s\n" "$provider_name" "$provider_video" && return 0
|
||||
[ -z "$provider_video" ] && continue
|
||||
[ -n "$debug" ] && printf "\033[1;32m %s\033[0m : %s\n" "$provider_name" "$provider_video" && continue
|
||||
info_$os "$provider_name links fetched.."
|
||||
choice=$(printf "stream\ndownload\ncast\nnext_mirror\nnext_anime" | menu_$os "??" '' "2")
|
||||
[ -z "$choice" ] && exit 0
|
||||
[ -z "$choice" ] && break
|
||||
case $choice in
|
||||
stream)
|
||||
info_$os "opening $title" "mpv"
|
||||
player_$os "$provider_video" "$title"
|
||||
break
|
||||
;;
|
||||
cast)
|
||||
info_$os "casting $title" "podcast"
|
||||
catt cast "$provider_video"
|
||||
break
|
||||
;;
|
||||
*mirror)
|
||||
continue
|
||||
@@ -78,16 +82,12 @@ printf "%s\n" "$url" | while read -r id title; do
|
||||
download)
|
||||
info_$os "Downloading $title" "downloader"
|
||||
case $provider_video in
|
||||
*m3u*) $terminal hls -ro "$download_dir/$title" "$provider_video" || error_$os "Downloading failed $title" && break ;;
|
||||
*) $terminal aria2c -U "$agent" --check-certificate=false -d "$download_dir" --summary-interval=0 -x 16 -s 16 --referer="https://$domain" "$provider_video" -o "$title.mp4" --download-result=hide || error_$os "Downloading failed $title" && break ;;
|
||||
*m3u*) $terminal hls -ro "$download_dir/$title" "$provider_video" || error_$os "Downloading failed $title" ;;
|
||||
*) $terminal aria2c -U "$agent" --check-certificate=false -d "$download_dir" --summary-interval=0 -x 16 -s 16 --referer="https://$domain" "$provider_video" -o "$title.mp4" --download-result=hide || error_$os "Downloading failed $title" ;;
|
||||
esac
|
||||
info_$os "Episode Downloaded $title"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
break
|
||||
done
|
||||
|
||||
[ -z "$debug" ] && error_$os "no more mirror links..sorry"
|
||||
done
|
||||
|
||||
22
revanced
22
revanced
@@ -18,6 +18,16 @@ download_apk(){
|
||||
info "[ $app ][ v$version ] Unable to Download.." "31" && exit 1
|
||||
}
|
||||
|
||||
download_keystore () {
|
||||
[ ! -f "$HOME/.secrets" ] && return 0
|
||||
#shellcheck disable=SC1091
|
||||
. "$HOME/.secrets"
|
||||
load_revanced_creds
|
||||
keystore="--keystore $tmp_dir/$RV_KEYSTORE"
|
||||
[ ! -f "$tmp_dir/$RV_KEYSTORE" ] && curl -s "$RV_KEYSTORE_URL" -o "$tmp_dir/$RV_KEYSTORE" && info "Downloaded Keystore file in $tmp_dir" "32" && return 0
|
||||
[ ! -f "$tmp_dir/$RV_KEYSTORE" ] && keystore=""
|
||||
}
|
||||
|
||||
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"
|
||||
@@ -25,6 +35,7 @@ date=$(date +%F)
|
||||
rv_cli="cli-$date.jar"
|
||||
rv_patch="patches-$date.jar"
|
||||
rv_inte="integrations-$date.apk"
|
||||
keystore=""
|
||||
|
||||
#check if directory is there
|
||||
[ -d "$tmp_dir" ] || mkdir "$tmp_dir"
|
||||
@@ -38,6 +49,8 @@ else
|
||||
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"
|
||||
fi
|
||||
|
||||
download_keystore
|
||||
|
||||
#choose your app
|
||||
[ -z "$1" ] && app=$(printf "youtube\nyoutube-music" | fzf --prompt="Select Application:" --layout=reverse --height=8 --border) || app=$1
|
||||
|
||||
@@ -47,8 +60,8 @@ fi
|
||||
case $app in
|
||||
youtube)
|
||||
arch="universal"
|
||||
[ -z "$2" ] && 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) || version=$2
|
||||
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,custom-player-overlay-opacity,hide-seekbar,hide-timestamp,hide-video-action-buttons,navigation-buttons,player-flyout-menu,remove-player-controls-background,spoof-app-version,swipe-controls"
|
||||
[ -z "$2" ] && version=$(curl -s "https://api.revanced.app/v2/patches/latest" | sed -nE 's|.*youtube","versions":\[[0-9\.",]*,"([^\}]*)"\].*|\1|p') || version=$2
|
||||
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,custom-player-overlay-opacity,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)
|
||||
@@ -57,6 +70,9 @@ case $app in
|
||||
exclude_patch_list=""
|
||||
out="yt-music-revanced-$version.apk"
|
||||
;;
|
||||
*)
|
||||
info "Wrong Package Name, please pass either 'youtube' or 'youtube-music'" "31"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ];then
|
||||
@@ -91,4 +107,4 @@ info "All listed Patches Excluded"
|
||||
info "Patching $app-$version.apk.."
|
||||
|
||||
#shellcheck disable=SC2086
|
||||
java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" --resource-cache "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches
|
||||
java -jar "$tmp_dir/$rv_cli" patch --patch-bundle "$tmp_dir/$rv_patch" --merge "$tmp_dir/$rv_inte" --out "$HOME/$out" $keystore --resource-cache "$tmp_dir/revanced-resource-cache" "$tmp_dir/$app-$version.apk" $exclude_patches
|
||||
|
||||
36
yt-music
36
yt-music
@@ -119,26 +119,24 @@ get_song_lyrics() {
|
||||
}
|
||||
|
||||
loop() {
|
||||
#this function does exactly what it says, it should run in the background, u can even put this in startup
|
||||
#it plays next song after the current song get played completely,it does nothing until u run the search_play function then this script kicks in
|
||||
#call it by script-name "loop" "print" for printing the remaining time in terminal
|
||||
#call it by script-name "loop" for anonymously
|
||||
#this function does exactly what it says, it should run in the background
|
||||
#it plays next song after the current song get played completely,it does nothing until u run the search_play function then this code kicks in
|
||||
trap cleanup_shit INT HUP TERM
|
||||
while :; do
|
||||
sleep 4
|
||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
||||
while [ -n "$pos" ]; do
|
||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
||||
[ -z "$1" ] || printf "\033[2K\rnext music in $pos second(s)%s" "$(echo '{ "command": ["get_property", "pause"]}' | socat - "$socket" | sed -nE 's_.*data":([^,]*).*_\1_p' | sh && printf " (paused)")"
|
||||
[ -z "$pos" ] && printf "\033[2K\r\n"
|
||||
sleep 2
|
||||
done
|
||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
||||
pgrep -f "$socket" >/dev/null || cleanup_shit
|
||||
#shellcheck disable=SC2030,SC2031
|
||||
[ -z "$pos" ] && i=$(cat "$logdir/counter") && : $((i+=1)) && pgrep -f "$socket" >/dev/null && [ -n "$(cat "$logdir/next")" ] && play "$(sed -n "$((i+=1))p" "$logdir/next")" "$1" && printf '%s' "$i" > "$logdir/counter"
|
||||
socat - "UNIX-CONNECT:$socket" | while read -r event;do
|
||||
#look for eof event
|
||||
if printf "%s" "$event" | grep -q "end-file.*eof";then
|
||||
i=$(cat "$logdir/counter")
|
||||
: $((i+=1))
|
||||
pgrep -f "$socket" >/dev/null || continue
|
||||
[ -n "$(cat "$logdir/next")" ]
|
||||
#shellcheck disable=SC2030
|
||||
play "$(sed -n "$((i+=1))p" "$logdir/next")" "$1"
|
||||
#shellcheck disable=SC2031
|
||||
printf '%s' "$i" > "$logdir/counter"
|
||||
tail -1 "$logdir/next" | grep -q "$(cut -d'>' -f2 < "$logdir/current")" && get_music_list
|
||||
fi
|
||||
done
|
||||
cleanup_shit
|
||||
}
|
||||
|
||||
play() {
|
||||
@@ -151,7 +149,7 @@ play() {
|
||||
|
||||
#get song's audio url
|
||||
random_no=$(head /dev/urandom | tr -dc '0-4' | cut -c1)
|
||||
andy_yt_ver="6.16.52"
|
||||
andy_yt_ver="6.22.51"
|
||||
extra_up=$((random_no >= 2))
|
||||
droid_agent="com.google.android.apps.youtube.music/$andy_yt_ver (Linux; U; Android 1$random_no) gzip"
|
||||
json="{
|
||||
@@ -205,7 +203,7 @@ search_play() {
|
||||
[ -z "$query" ] && notify-send "Err.. Search query empty" -u critical -h "string:x-canonical-private-synchronous:${0##*/}" && exit 1
|
||||
|
||||
#storing context
|
||||
printf '{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20230731.00.00"}}' >"$logdir/context"
|
||||
printf '{"client":{"clientName":"WEB_REMIX","clientVersion":"1.20231010.05.00"}}' >"$logdir/context"
|
||||
|
||||
#json for song search
|
||||
json_search="{
|
||||
|
||||
Reference in New Issue
Block a user