minor changes

This commit is contained in:
coolnsx
2023-07-03 22:50:31 +05:30
parent 31b2570cf3
commit 9287e03f41
9 changed files with 333 additions and 340 deletions

105
ani-new
View File

@@ -1,59 +1,63 @@
#!/bin/sh
down() {
info_$os "$3 links fetched.."
choice=$(printf "stream\ndownload\ncast\nnext mirror" | menu_$os "??")
[ -z "$choice" ] && exit 0
[ "$choice" = "stream" ] && player_$os "$2" "$title" && info_$os "opening $title" "mpv" && exit 0
[ "$choice" = "cast" ] && info_$os "casting $title" "podcast" && catt cast "$2" && exit 0
[ "$choice" = "next mirror" ] && return 0
info_$os "Downloading $title" "downloader"
case $2 in
*m3u*) $terminal hls -n 300 -ro "$download_dir/$title" "$2" || (error_$os "Downloading failed $title" && exit 0) ;;
*) $terminal aria2c -U "$agent" --check-certificate=false -d "$download_dir" --summary-interval=0 -x 16 -s 16 --referer="$1" "$2" -o "$title.mp4" --download-result=hide || (error_$os "Downloading failed $title" && exit 0) ;;
esac
info_$os "Episode Downloaded $title"
exit 0
[ -n "$debug" ] && printf "\033[1;32m %s\033[0m : %s\n" "$3" "$2" && return 0
info_$os "$3 links fetched.."
choice=$(printf "stream\ndownload\ncast\nnext mirror" | menu_$os "??")
[ -z "$choice" ] && exit 0
[ "$choice" = "stream" ] && player_$os "$2" "$title" && info_$os "opening $title" "mpv" && exit 0
[ "$choice" = "cast" ] && info_$os "casting $title" "podcast" && catt cast "$2" && exit 0
[ "$choice" = "next mirror" ] && return 0
info_$os "Downloading $title" "downloader"
case $2 in
*m3u*) $terminal hls -n 300 -ro "$download_dir/$title" "$2" || (error_$os "Downloading failed $title" && exit 0) ;;
*) $terminal aria2c -U "$agent" --check-certificate=false -d "$download_dir" --summary-interval=0 -x 16 -s 16 --referer="$1" "$2" -o "$title.mp4" --download-result=hide || (error_$os "Downloading failed $title" && exit 0) ;;
esac
info_$os "Episode Downloaded $title"
exit 0
}
decrypt_allanime() {
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
dec=$(printf '%d' "0x$hex")
xor=$((dec ^ 48))
oct=$(printf "%03o" "$xor")
#shellcheck disable=SC2059
printf "\\$oct"
done
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))
oct=$(printf "%03o" "$xor")
#shellcheck disable=SC2059
printf "\\$oct"
done
printf "%s" "$-" | grep -q 'x' || set -x
}
provider_run() {
info_$os "Fetching $1 links"
provider_id="$(decrypt_allanime "$(printf "%s" "$data" | sed -n "$2" | head -1 | cut -d':' -f2)" | sed "s/\/clock/\/clock\.json/")"
[ -z "$provider_id" ] && return 0
provider_video=$(curl -s "https://embed.ssbcontent.site$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 "$3" ] && printf "%s : %s\n" "$1" "$provider_video" && return 0
case $provider_video in
*repackager.wixmp.com*) down "$base_url" "$(printf %s "$provider_video" | cut -d',' -f1,2 | tr -d ',' | sed 's|repackager.wixmp.com/||g')/mp4/file.mp4" "$1" ;;
*) down "$base_url" "$provider_video" "$1" ;;
esac
info_$os "Fetching $1 links"
provider_id="$(decrypt_allanime "$(printf "%s" "$data" | sed -n "$2" | head -1 | cut -d':' -f2)" | sed "s/\/clock/\/clock\.json/")"
[ -z "$provider_id" ] && return 0
provider_video=$(curl -s "https://embed.ssbcontent.site$provider_id" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p')
[ -z "$provider_video" ] && return 0
case $provider_video in
*repackager.wixmp.com*) down "$base_url" "$(printf %s "$provider_video" | head -1 | cut -d',' -f1,2 | tr -d ',' | sed 's|repackager.wixmp.com/||g')/mp4/file.mp4" "$1" ;;
*rmbl.ws*) down "$base_url" "$(printf %s "$provider_video" | tail -1)" "$1" ;;
*) down "$base_url" "$(printf %s "$provider_video" | head -1)" "$1" ;;
esac
}
base_url="https://api.allanime.day"
agent="Mozilla/5.0"
[ -n "$2" ] && debug=1
case $(uname -o) in
*ndroid*)
os="droid"
download_dir="/sdcard"
script_dir="$HOME"
;;
*)
os="linux"
download_dir="$HOME/Downloads"
terminal="foot -e"
script_dir="$HOME/repos_scripts"
;;
*ndroid*)
os="droid"
download_dir="/sdcard"
script_dir="$HOME"
;;
*)
os="linux"
download_dir="$HOME/Downloads"
terminal="foot -e"
script_dir="$HOME/repos_scripts"
;;
esac
# shellcheck source=./.functions
@@ -83,21 +87,10 @@ provider_run "wetransfer" "/Kir :/p" "$2"
#sharepoint links
provider_run "sharepoint" "/S-mp4 :/p" "$2"
#rumble links
provider_run "rumble" "/Rab :/p" "$2"
#gogoplay links
provider_run "gogoplay" "/Luf-mp4 :/p" "$2"
id=$(printf "%s" "$data" | sed -nE 's/Vid-mp4 :.*?id=([^&]*).*/\1/p')
[ -z "$id" ] && error_$os "no more mirror links..sorry" && exit 0
resp="$(curl -A "$agent" -s "https://playtaku.net/streaming.php?id=$id" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/p')"
info_$os "Fetching mp4upload links"
mp4up_link=$(printf "%s" "$resp" | grep "mp4upload")
[ -z "$mp4up_link" ] || mp4up_video=$(curl -A "$agent" -s "$mp4up_link" -H "DNT: 1" | sed -nE 's_.*embed\|(.*)\|.*blank.*\|(.*)\|(.*)\|(.*)\|(.*)\|src.*_https://\1.mp4upload.com:\5/d/\4/\3.\2_p')
[ -z "$mp4up_video" ] || down "$mp4up_link" "$mp4up_video" "mp4upload"
info_$os "Fetching xstreamcdn links"
fb_id=$(printf "%s" "$resp" | sed -n "s_.*fembed.*/v/__p")
[ -z "$fb_id" ] || fb_video=$(curl -A "$agent" -s -X POST "https://fembed-hd.com/api/source/$fb_id" -H "x-requested-with:XMLHttpRequest" | sed -e 's/\\//g' -e 's/.*data"://' | tr "}" "\n" | sed -nE 's/.*file":"(.*)","label.*/\1/p' | tail -1)
[ -z "$fb_video" ] || down "https://fembed-hd.com/v/$fb_id" "$fb_video" "xstreamcdn"
error_$os "no more mirror links..sorry" && exit 0
[ -z "$2" ] && error_$os "no more mirror links..sorry" && exit 0