Skip to content

Commit

Permalink
fix: f u gogo (#563)
Browse files Browse the repository at this point in the history
* docs: update android instructions

* fix: new decrypt function, now working again

* appease the linter

* * fix: dash compatibility
* QA: `printf` instead of `echo`

* chore: appease linter

* fix: grepping 404 in url

* style: fix indentation
* style: remove full path from help menu

Co-authored-by: Derisis13 <[email protected]>
Co-authored-by: zenith71 <[email protected]>
  • Loading branch information
3 people authored Mar 4, 2022
1 parent c527f25 commit f93a332
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions ani-cli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Project repository: https://github.com/pystardust/ani-cli

# Version number
VERSION="1.8.3"
VERSION="1.9.0"


#######################
Expand All @@ -31,9 +31,9 @@ help_text () {
done <<-EOF
Usage:
$0 [-v] [-q <quality>] [-a <episode>] [-d | -p <download_dir>] [<query>]
$0 [-v] [-q <quality>] -c
$0 -h | -D | -U | -V
${0##*/} [-v] [-q <quality>] [-a <episode>] [-d | -p <download_dir>] [<query>]
${0##*/} [-v] [-q <quality>] -c
${0##*/} -h | -D | -U | -V
Options:
-c continue watching anime from history
Expand Down Expand Up @@ -158,27 +158,27 @@ get_dpage_link() {
# credits to fork: https://github.com/Dink4n/ani-cli for the fix
for params in "-episode-$ep_no" "-$ep_no" "-episode-$ep_no-1" "-camrip-episode-$ep_no"; do
anime_page=$(curl -s "$base_url/$anime_id$params")
printf '%s' "$anime_page" | grep -q '404' || break
printf '%s' "$anime_page" | grep -q '<h1 class="entry-title">404</h1>' || break
done
printf '%s' "$anime_page" |
sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' |
sed 's/^/https:/g'
sed -n -E 's/.*class="active" rel="1" data-video="([^"]*)".*/\1/p' | sed 's/^/https:/g'
}

decrypt_link() {
ajax_url='https://gogoplay.io/encrypt-ajax.php'
secret_key='3235373436353338353932393338333936373634363632383739383333323838'
iv='34323036393133333738303038313335'

#get the id from the url
video_id=$(printf '%s' "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g')

#construct ajax parameters
ajax=$(printf '%s' "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)

#send the request to the ajax url
curl -s -H 'x-requested-with:XMLHttpRequest' "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" |
sed -e 's/\].*/\]/' -e 's/\\//g' |
secret_key='3235373136353338353232393338333936313634363632323738383333323838'
iv='31323835363732393835323338333933'
ajax_url="https://gogoplay4.com/encrypt-ajax.php"
crypto_data=$(curl -s "$1" | sed -nE 's/.*data-value="([^"]*)".*/\1/p')
id=$(printf '%s' "$crypto_data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | cut -d '&' -f1)

#encrypt and create the final ajax
ajax=$(printf "%s\010\016\003\010\t\003\004\t" "$id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)

#send request and get the data(most lamest way)
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')

#decrypt the data to get final links
printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' |
grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*'
}

Expand Down

0 comments on commit f93a332

Please sign in to comment.