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
|
#!/bin/sh
|
||||||
|
|
||||||
|
#shellcheck disable=SC2086
|
||||||
|
|
||||||
menu_droid() {
|
menu_droid() {
|
||||||
fzf --prompt="$1" $2
|
fzf --prompt="$1" $2
|
||||||
}
|
}
|
||||||
@@ -14,6 +16,7 @@ search_droid() {
|
|||||||
|
|
||||||
search_linux() {
|
search_linux() {
|
||||||
query=$(: | menu_linux "$1 ")
|
query=$(: | menu_linux "$1 ")
|
||||||
|
export query
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent_linux() {
|
torrent_linux() {
|
||||||
|
|||||||
24
ani-new
24
ani-new
@@ -30,7 +30,7 @@ case $(uname -o) in
|
|||||||
*)
|
*)
|
||||||
os="linux"
|
os="linux"
|
||||||
download_dir="$HOME/Downloads"
|
download_dir="$HOME/Downloads"
|
||||||
terminal="${TERMINAL:-foot} -e"
|
[ -t 1 ] || terminal="${TERMINAL:-foot} -e"
|
||||||
script_dir="$HOME/repos_scripts"
|
script_dir="$HOME/repos_scripts"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -49,6 +49,8 @@ printf "%s\n" "$url" | while read -r id title; do
|
|||||||
ep_no=$(printf "%s" "$title" | sed 's/.*Episode //g')
|
ep_no=$(printf "%s" "$title" | sed 's/.*Episode //g')
|
||||||
|
|
||||||
info_$os "Loading Episode $title.."
|
info_$os "Loading Episode $title.."
|
||||||
|
[ -n "$debug" ] && printf "\n\033[1;36m title\033[0m : %s\n" "$title"
|
||||||
|
|
||||||
#shellcheck disable=SC2016
|
#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')
|
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"
|
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
|
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"
|
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/")"
|
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)
|
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
|
[ -z "$provider_video" ] && continue
|
||||||
[ -n "$debug" ] && printf "\033[1;32m %s\033[0m : %s\n" "$provider_name" "$provider_video" && return 0
|
[ -n "$debug" ] && printf "\033[1;32m %s\033[0m : %s\n" "$provider_name" "$provider_video" && continue
|
||||||
info_$os "$provider_name links fetched.."
|
info_$os "$provider_name links fetched.."
|
||||||
choice=$(printf "stream\ndownload\ncast\nnext_mirror\nnext_anime" | menu_$os "??" '' "2")
|
choice=$(printf "stream\ndownload\ncast\nnext_mirror\nnext_anime" | menu_$os "??" '' "2")
|
||||||
[ -z "$choice" ] && exit 0
|
[ -z "$choice" ] && break
|
||||||
case $choice in
|
case $choice in
|
||||||
stream)
|
stream)
|
||||||
info_$os "opening $title" "mpv"
|
info_$os "opening $title" "mpv"
|
||||||
player_$os "$provider_video" "$title"
|
player_$os "$provider_video" "$title"
|
||||||
|
break
|
||||||
;;
|
;;
|
||||||
cast)
|
cast)
|
||||||
info_$os "casting $title" "podcast"
|
info_$os "casting $title" "podcast"
|
||||||
catt cast "$provider_video"
|
catt cast "$provider_video"
|
||||||
|
break
|
||||||
;;
|
;;
|
||||||
*mirror)
|
*mirror)
|
||||||
continue
|
continue
|
||||||
@@ -78,16 +82,12 @@ printf "%s\n" "$url" | while read -r id title; do
|
|||||||
download)
|
download)
|
||||||
info_$os "Downloading $title" "downloader"
|
info_$os "Downloading $title" "downloader"
|
||||||
case $provider_video in
|
case $provider_video in
|
||||||
*m3u*) $terminal hls -ro "$download_dir/$title" "$provider_video" || 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" && 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" ;;
|
||||||
esac
|
esac
|
||||||
info_$os "Episode Downloaded $title"
|
info_$os "Episode Downloaded $title"
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$debug" ] && error_$os "no more mirror links..sorry"
|
|
||||||
done
|
done
|
||||||
|
|||||||
24
revanced
24
revanced
@@ -18,6 +18,16 @@ download_apk(){
|
|||||||
info "[ $app ][ v$version ] Unable to Download.." "31" && exit 1
|
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"
|
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"
|
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"
|
apk_provider_url="https://www.apkmirror.com"
|
||||||
@@ -25,6 +35,7 @@ date=$(date +%F)
|
|||||||
rv_cli="cli-$date.jar"
|
rv_cli="cli-$date.jar"
|
||||||
rv_patch="patches-$date.jar"
|
rv_patch="patches-$date.jar"
|
||||||
rv_inte="integrations-$date.apk"
|
rv_inte="integrations-$date.apk"
|
||||||
|
keystore=""
|
||||||
|
|
||||||
#check if directory is there
|
#check if directory is there
|
||||||
[ -d "$tmp_dir" ] || mkdir "$tmp_dir"
|
[ -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"
|
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
|
fi
|
||||||
|
|
||||||
|
download_keystore
|
||||||
|
|
||||||
#choose your app
|
#choose your app
|
||||||
[ -z "$1" ] && app=$(printf "youtube\nyoutube-music" | fzf --prompt="Select Application:" --layout=reverse --height=8 --border) || app=$1
|
[ -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
|
case $app in
|
||||||
youtube)
|
youtube)
|
||||||
arch="universal"
|
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
|
[ -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"
|
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"
|
out="yt-revanced-$version.apk"
|
||||||
;;
|
;;
|
||||||
youtube-music)
|
youtube-music)
|
||||||
@@ -57,6 +70,9 @@ case $app in
|
|||||||
exclude_patch_list=""
|
exclude_patch_list=""
|
||||||
out="yt-music-revanced-$version.apk"
|
out="yt-music-revanced-$version.apk"
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
info "Wrong Package Name, please pass either 'youtube' or 'youtube-music'" "31"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ];then
|
if [ -f "$tmp_dir/$app-$version.apk" ] && [ ! -f "$tmp_dir/$app-$version.apk.aria2" ];then
|
||||||
@@ -67,7 +83,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Checking Patches for excluding.."
|
info "Checking Patches for excluding.."
|
||||||
patch_list=$(java -jar "$tmp_dir/$rv_cli" list-patches "$tmp_dir/$rv_patch" --with-descriptions=false)
|
patch_list=$(java -jar "$tmp_dir/$rv_cli" list-patches "$tmp_dir/$rv_patch" --with-descriptions=false)
|
||||||
|
|
||||||
if [ -n "$exclude_patch_list" ];then
|
if [ -n "$exclude_patch_list" ];then
|
||||||
info "Excluding Patches.." "33"
|
info "Excluding Patches.." "33"
|
||||||
@@ -91,4 +107,4 @@ info "All listed Patches Excluded"
|
|||||||
info "Patching $app-$version.apk.."
|
info "Patching $app-$version.apk.."
|
||||||
|
|
||||||
#shellcheck disable=SC2086
|
#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
|
||||||
|
|||||||
38
yt-music
38
yt-music
@@ -119,26 +119,24 @@ get_song_lyrics() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loop() {
|
loop() {
|
||||||
#this function does exactly what it says, it should run in the background, u can even put this in startup
|
#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 script kicks in
|
#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
|
||||||
#call it by script-name "loop" "print" for printing the remaining time in terminal
|
|
||||||
#call it by script-name "loop" for anonymously
|
|
||||||
trap cleanup_shit INT HUP TERM
|
trap cleanup_shit INT HUP TERM
|
||||||
while :; do
|
socat - "UNIX-CONNECT:$socket" | while read -r event;do
|
||||||
sleep 4
|
#look for eof event
|
||||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
if printf "%s" "$event" | grep -q "end-file.*eof";then
|
||||||
while [ -n "$pos" ]; do
|
i=$(cat "$logdir/counter")
|
||||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
: $((i+=1))
|
||||||
[ -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)")"
|
pgrep -f "$socket" >/dev/null || continue
|
||||||
[ -z "$pos" ] && printf "\033[2K\r\n"
|
[ -n "$(cat "$logdir/next")" ]
|
||||||
sleep 2
|
#shellcheck disable=SC2030
|
||||||
done
|
play "$(sed -n "$((i+=1))p" "$logdir/next")" "$1"
|
||||||
pos=$(echo '{ "command": ["get_property", "time-remaining"]}' | socat - "$socket" | sed -nE 's_.*data":([^\.]*).*_\1_p')
|
#shellcheck disable=SC2031
|
||||||
pgrep -f "$socket" >/dev/null || cleanup_shit
|
printf '%s' "$i" > "$logdir/counter"
|
||||||
#shellcheck disable=SC2030,SC2031
|
tail -1 "$logdir/next" | grep -q "$(cut -d'>' -f2 < "$logdir/current")" && get_music_list
|
||||||
[ -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"
|
fi
|
||||||
tail -1 "$logdir/next" | grep -q "$(cut -d'>' -f2 < "$logdir/current")" && get_music_list
|
|
||||||
done
|
done
|
||||||
|
cleanup_shit
|
||||||
}
|
}
|
||||||
|
|
||||||
play() {
|
play() {
|
||||||
@@ -151,7 +149,7 @@ play() {
|
|||||||
|
|
||||||
#get song's audio url
|
#get song's audio url
|
||||||
random_no=$(head /dev/urandom | tr -dc '0-4' | cut -c1)
|
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))
|
extra_up=$((random_no >= 2))
|
||||||
droid_agent="com.google.android.apps.youtube.music/$andy_yt_ver (Linux; U; Android 1$random_no) gzip"
|
droid_agent="com.google.android.apps.youtube.music/$andy_yt_ver (Linux; U; Android 1$random_no) gzip"
|
||||||
json="{
|
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
|
[ -z "$query" ] && notify-send "Err.. Search query empty" -u critical -h "string:x-canonical-private-synchronous:${0##*/}" && exit 1
|
||||||
|
|
||||||
#storing context
|
#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 for song search
|
||||||
json_search="{
|
json_search="{
|
||||||
|
|||||||
Reference in New Issue
Block a user