diff --git a/ani-cli b/ani-cli index 3b5b213..7c67e03 100755 --- a/ani-cli +++ b/ani-cli @@ -5,6 +5,7 @@ player_fn="mpv" prog="ani-cli" site="gogoanime.film" +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36" c_red="\033[1;31m" c_green="\033[1;32m" @@ -21,7 +22,6 @@ help_text () { USAGE: $prog -h show this help text -d download episode - -c cast anime EOF } @@ -37,23 +37,19 @@ err () { search_anime () { # get anime name along with its id search=$1 - curl -s "https://$site//search.html?keyword=$search" | - sed -n -E ' - s_^[[:space:]]*/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1) - else - catt cast "$video_url" - fi + setsid -f $player_fn --http-header-fields="User-Agent:$agent" --referrer="$embedded_url" "$video_url" >/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1) else printf "Downloading episode $episode ...\n" # add 0 padding to the episode name episode=$(printf "%03d" $episode) { - aria2c -x 16 -s 16 --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" && + aria2c -x 16 -s 16 -U "$agent" --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" && printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" || printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode" } @@ -191,7 +177,6 @@ trap "printf '$c_reset';exit 1" INT HUP # option parsing is_download=0 -is_cast=0 while getopts 'hdc' OPT; do case $OPT in h) @@ -201,9 +186,6 @@ while getopts 'hdc' OPT; do d) is_download=1 ;; - c) - is_cast=1 - ;; esac done shift $((OPTIND - 1)) diff --git a/ani-new b/ani-new index e16064b..7202c75 100755 --- a/ani-new +++ b/ani-new @@ -1,17 +1,18 @@ #!/bin/sh +agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36" decrypt_link() { ajax_url='https://gogoplay.io/encrypt-ajax.php' video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g') secret_key='3235373436353338353932393338333936373634363632383739383333323838' iv='34323036393133333738303038313335' - ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a) - curl -s -H 'x-requested-with:XMLHttpRequest' "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1 + ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a) + curl -s -H "X-Requested-With:XMLHttpRequest" -H "User-Agent:$agent" -H "Referer:https:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1 } -url=$(curl -s "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:") +url=$(curl -s -A "$agent" "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:") [ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0 -refr=$(curl -s "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]*(.*)<\/span><.*/\1/p') echo "pages : $pg" @@ -19,4 +19,4 @@ echo "waiting 5 sec for pages to download completely" sleep 5 echo "concatenating pages to pdf" convert "$dir/*" "$num.pdf" && printf "saved pdf as $num.pdf\nopening pdf...enjoy 😏😏" && setsid -f xdg-open "$num.pdf" -rm -rvf $dir +rm -rf $dir