port over new decrypt function to fix scraping issue

This commit is contained in:
ksyasuda 2022-03-03 18:04:20 -08:00
parent 4af41db0bf
commit aa39625956

28
ani-cli
View File

@ -89,29 +89,25 @@ get_dpage_link() {
done done
printf '%s' "$anime_page" | printf '%s' "$anime_page" |
sed -n -E 's/^[[:space:]]*<a href="#" rel="100" data-video="([^"]*)".*/\1/p' | sed -n -E 's/.*class="active" rel="1" data-video="([^"]*)".*/\1/p' | sed 's/^/https:/g'
sed 's/^/https:/g'
} }
decrypt_link() { decrypt_link() {
lg "BEGIN: decrypt_link()" > /dev/stderr lg "BEGIN: decrypt_link()" > /dev/stderr
ajax_url="https://gogoplay.io/encrypt-ajax.php" secret_key='3235373136353338353232393338333936313634363632323738383333323838'
iv='31323835363732393835323338333933'
ajax_url="https://gogoplay4.com/encrypt-ajax.php"
#get the id from the url crypto_data=$(curl -s "$1" | sed -nE 's/.*data-value="([^"]*)".*/\1/p')
video_id=$(echo "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g') id=$(printf '%s' "$crypto_data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | cut -d '&' -f1)
lg "video_id -> $video_id" > /dev/stderr #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" | cut -d\" -f4 | tr -d '\\')
#construct ajax parameters #decrypt the data to get final links
secret_key='3235373436353338353932393338333936373634363632383739383333323838' printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' |
iv='34323036393133333738303038313335'
ajax=$(echo "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
lg "ajax -> $ajax" > /dev/stderr
#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' |
grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*' grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*'
lg "END: decrypt_link()" > /dev/stderr
} }
get_video_quality() { get_video_quality() {