mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
speling is difikult
This commit is contained in:
@@ -5,7 +5,7 @@ menu_droid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
menu_linux() {
|
menu_linux() {
|
||||||
bemenu --fn 'Cascadia Mono 15' -i -c -W "0.${3:-6}" -B 3 -l 25 -p "$1" --fixed-height 25
|
bemenu --fn 'Cascadia Mono 15' -i -c -W "0.${3:-6}" -B 3 -l 25 -p "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
search_droid() {
|
search_droid() {
|
||||||
@@ -45,5 +45,5 @@ player_droid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
player_linux() {
|
player_linux() {
|
||||||
setsid -f mpv "$1" --force-media-title="$2"
|
mpv "$1" --force-media-title="$2"
|
||||||
}
|
}
|
||||||
|
|||||||
108
ani-new
108
ani-new
@@ -1,22 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
down() {
|
|
||||||
[ -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 "??" '' "2")
|
|
||||||
[ -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 -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() {
|
decrypt_allanime() {
|
||||||
printf "%s" "$-" | grep -q 'x' && set +x
|
printf "%s" "$-" | grep -q 'x' && set +x
|
||||||
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
|
for hex in $(printf '%s' "$1" | sed 's/../&\n/g'); do
|
||||||
@@ -29,26 +12,14 @@ decrypt_allanime() {
|
|||||||
printf "%s" "$-" | grep -q 'x' || set -x
|
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')
|
|
||||||
[ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
allanime_curl() {
|
allanime_curl() {
|
||||||
curl -e 'https://allanime.to' -sL --cipher AES256-SHA256 -G "${base_url}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2"
|
curl -e "https://allanime.to" -sL --cipher AES256-SHA256 -G "https://api.${domain}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
base_url="https://api.allanime.day"
|
domain="allanime.day"
|
||||||
agent="Mozilla/5.0"
|
random_no=$(head /dev/urandom | tr -dc '3-7' | cut -c1)
|
||||||
[ -n "$2" ] && debug=1
|
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/11${random_no}.0.0.0 Safari/537.36"
|
||||||
|
debug=$2
|
||||||
|
|
||||||
case $(uname -o) in
|
case $(uname -o) in
|
||||||
*ndroid*)
|
*ndroid*)
|
||||||
@@ -59,7 +30,7 @@ case $(uname -o) in
|
|||||||
*)
|
*)
|
||||||
os="linux"
|
os="linux"
|
||||||
download_dir="$HOME/Downloads"
|
download_dir="$HOME/Downloads"
|
||||||
terminal="$TERMINAL -e"
|
terminal="${TERMINAL:-foot} -e"
|
||||||
script_dir="$HOME/repos_scripts"
|
script_dir="$HOME/repos_scripts"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -67,33 +38,56 @@ esac
|
|||||||
# shellcheck source=./.functions
|
# shellcheck source=./.functions
|
||||||
. "$script_dir/.functions"
|
. "$script_dir/.functions"
|
||||||
trap "exit 0" INT HUP
|
trap "exit 0" INT HUP
|
||||||
info_$os "Parsing $base_url.. Please wait..."
|
info_$os "Parsing $domain.. Please wait..."
|
||||||
|
|
||||||
#shellcheck disable=SC2016
|
#shellcheck disable=SC2016
|
||||||
query='query($search: SearchInput $limit: Int $page: Int $translationType: VaildTranslationTypeEnumType $countryOrigin: VaildCountryOriginEnumType) { shows( search: $search limit: $limit page: $page translationType: $translationType countryOrigin: $countryOrigin ) {edges { _id name lastEpisodeInfo __typename}}}'
|
[ -z "$1" ] && url=$(allanime_curl 'query=query($search: SearchInput $limit: Int $page: Int $translationType: VaildTranslationTypeEnumType $countryOrigin: VaildCountryOriginEnumType) { shows( search: $search limit: $limit page: $page translationType: $translationType countryOrigin: $countryOrigin ) {edges { _id name lastEpisodeInfo __typename}}}' 'variables={"search":{"sortBy":"Recent","allowAdult":true,"allowUnknown":true},"limit":40,"page":1,"translationType":"sub","countryOrigin":"JP"}' | sed 's|Show|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p' | menu_$os "Select Anime: " '--with-nth 2.. -m' | tr ':' ' ' | tr -s ' ') || url=$(printf "%s" "$1" | sed -nE 's|.*/bangumi/([^/]*)/([^/]*)/.*episode-([^-]*)-sub|\1\t\2 Episode \3|p')
|
||||||
[ -z "$1" ] && url=$(allanime_curl "query=$query" 'variables={"search":{"sortBy":"Recent","allowAdult":true,"allowUnknown":true},"limit":40,"page":1,"translationType":"sub","countryOrigin":"JP"}' | sed 's|Show|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p' | menu_$os "Select Anime: " '--with-nth 2..' | tr ':' ' ' | tr -s ' ') || url=$(printf "%s" "$1" | sed -nE 's|.*/watch/(.*)-sub|\1|p')
|
|
||||||
|
|
||||||
[ -z "$url" ] && error_$os "No anime selected" && exit 0
|
[ -z "$url" ] && error_$os "No anime selected" && exit 0
|
||||||
title=$(printf "%s" "$url" | cut -f2-)
|
|
||||||
id=$(printf "%s" "$url" | cut -f1)
|
|
||||||
ep_no=$(printf "%s" "$url" | sed 's/.*Episode //g')
|
|
||||||
|
|
||||||
info_$os "Loading Episode $title.."
|
printf "%s\n" "$url" | while read -r id title; do
|
||||||
#shellcheck disable=SC2016
|
ep_no=$(printf "%s" "$title" | sed 's/.*Episode //g')
|
||||||
episode_embed_gql='query ($showId: String!, $translationType: VaildTranslationTypeEnumType!, $episodeString: String!) { episode( showId: $showId translationType: $translationType episodeString: $episodeString ) { episodeString sourceUrls }}'
|
|
||||||
data=$(allanime_curl "variables={\"showId\":\"$id\",\"translationType\":\"sub\",\"countryOrigin\":\"ALL\",\"episodeString\":\"$ep_no\"}" "query=$episode_embed_gql" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":"--([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p')
|
|
||||||
info_$os "Fetching Embed links"
|
|
||||||
|
|
||||||
#dropbox links
|
info_$os "Loading Episode $title.."
|
||||||
provider_run "dropbox" "/Sak :/p" "$2"
|
#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"
|
||||||
|
|
||||||
#wetransfer links
|
printf 'dropbox\tSak\nwetransfer\tKir\nsharepoint\tS-mp4\ngogoplay\tLuf-mp4\n' | while read -r provider_name provider_regex; do
|
||||||
provider_run "wetransfer" "/Kir :/p" "$2"
|
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
|
||||||
|
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
|
||||||
|
info_$os "$provider_name links fetched.."
|
||||||
|
choice=$(printf "stream\ndownload\ncast\nnext_mirror\nnext_anime" | menu_$os "??" '' "2")
|
||||||
|
[ -z "$choice" ] && exit 0
|
||||||
|
case $choice in
|
||||||
|
stream)
|
||||||
|
info_$os "opening $title" "mpv"
|
||||||
|
player_$os "$provider_video" "$title"
|
||||||
|
;;
|
||||||
|
cast)
|
||||||
|
info_$os "casting $title" "podcast"
|
||||||
|
catt cast "$provider_video"
|
||||||
|
;;
|
||||||
|
*mirror)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
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 ;;
|
||||||
|
esac
|
||||||
|
info_$os "Episode Downloaded $title"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
#sharepoint links
|
[ -z "$debug" ] && error_$os "no more mirror links..sorry"
|
||||||
provider_run "sharepoint" "/S-mp4 :/p" "$2"
|
done
|
||||||
|
|
||||||
#gogoplay links
|
|
||||||
provider_run "gogoplay" "/Luf-mp4 :/p" "$2"
|
|
||||||
|
|
||||||
[ -z "$2" ] && error_$os "no more mirror links..sorry" && exit 0
|
|
||||||
|
|||||||
Reference in New Issue
Block a user