mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
Commit committed
This commit is contained in:
18
ani-new
18
ani-new
@@ -4,10 +4,25 @@ allanime_curl() {
|
|||||||
curl -e "https://allanime.to" -sL -G "https://api.${domain}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2"
|
curl -e "https://allanime.to" -sL -G "https://api.${domain}/api" -A "$agent" --data-urlencode "$1" --data-urlencode "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
domain="allanime.day"
|
domain="allanime.day"
|
||||||
|
run_file="${TMPDIR:-/tmp}/${0##*/}_run"
|
||||||
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-3' | cut -c1).0.0.0 Safari/537.36"
|
agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12$(head /dev/urandom | tr -dc '0-3' | cut -c1).0.0.0 Safari/537.36"
|
||||||
debug=$2
|
debug=$2
|
||||||
|
|
||||||
|
\cat << EOF > $run_file
|
||||||
|
search() {
|
||||||
|
curl -e "https://allanime.to" -sL -G "https://api.${domain}/api" -A "$agent" --data-urlencode '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}}}' --data-urlencode 'variables={"search":{"sortBy":"Recent","allowAdult":true,"allowUnknown":true,"query":"'"\$1"'"},"limit":40,"page":1,"translationType":"sub","countryOrigin":"ALL"}' | sed 's|Show|\n|g' | sed 's|__typename|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p'
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -n "\$2" ] && search "\$1"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x "$run_file"
|
||||||
|
|
||||||
case $(uname -o) in
|
case $(uname -o) in
|
||||||
*ndroid*)
|
*ndroid*)
|
||||||
os="droid"
|
os="droid"
|
||||||
@@ -24,11 +39,12 @@ esac
|
|||||||
|
|
||||||
# shellcheck source=./.functions
|
# shellcheck source=./.functions
|
||||||
. "$script_dir/.functions"
|
. "$script_dir/.functions"
|
||||||
|
. "$run_file"
|
||||||
trap "exit 0" INT HUP
|
trap "exit 0" INT HUP
|
||||||
info_$os "Parsing $domain.. Please wait..."
|
info_$os "Parsing $domain.. Please wait..."
|
||||||
|
|
||||||
#shellcheck disable=SC2016
|
#shellcheck disable=SC2016
|
||||||
[ -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|__typename|\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/([^/]*)/([^/]*)/p-([^-]*)-sub|\1\t\2 Episode \3|p')
|
[ -z "$1" ] && url=$(search | fzf --bind="change:reload:$run_file {q} 1" --prompt="Select Anime: " --with-nth 2.. -m | tr ':' ' ' | tr -s ' ') || url=$(printf "%s" "$1" | sed -nE 's|.*/bangumi/([^/]*)/([^/]*)/p-([^-]*)-sub|\1\t\2 Episode \3|p')
|
||||||
|
|
||||||
[ -z "$url" ] && error_$os "No anime selected" && exit 0
|
[ -z "$url" ] && error_$os "No anime selected" && exit 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user