fix same episode playing

This commit is contained in:
ksyasuda 2022-05-03 20:36:02 -07:00
parent 73e6b8d181
commit ce83a6155b

12
ani-cli
View File

@ -110,20 +110,20 @@ generate_link() {
case "$1" in case "$1" in
1) 1)
refr=$(printf "%s" "$links" | grep "mp4upload") refr=$(printf "%s" "$links" | grep "mp4upload")
[ -z "$refr" ] || video_links="$(curl -A "$AGENT" -s "$refr" -H "DNT: 1" | sed -nE 's_.*embed\|(.*)\|.*blank.*\|(.*)\|(.*)\|(.*)\|(.*)\|src.*_https://\1.mp4upload.com:\5/d/\4/\3.\2_p')" [ -z "$refr" ] || result_links="$(curl -A "$AGENT" -s "$refr" -H "DNT: 1" | sed -nE 's_.*embed\|(.*)\|.*blank.*\|(.*)\|(.*)\|(.*)\|(.*)\|src.*_https://\1.mp4upload.com:\5/d/\4/\3.\2_p')"
;; ;;
2) 2)
dood_id=$(printf "%s" "$links" | sed -n "s_.*dood.*/e/__p") dood_id=$(printf "%s" "$links" | sed -n "s_.*dood.*/e/__p")
refr="https://dood.ws/d/$dood_id" refr="https://dood.ws/d/$dood_id"
[ -z "$dood_id" ] || dood_link=$(curl -A "$AGENT" -s "https://dood.ws/d/$dood_id" | sed -nE 's/<a href="(.*)" class="btn.*justify.*/\1/p') [ -z "$dood_id" ] || dood_link=$(curl -A "$AGENT" -s "https://dood.ws/d/$dood_id" | sed -nE 's/<a href="(.*)" class="btn.*justify.*/\1/p')
sleep 0.5 sleep 0.5
[ -z "$dood_link" ] || video_links="$(curl -A "$AGENT" -s "https://dood.ws${dood_link}" | sed -nE "s/.*window.open.*'(.*)',.*/\1/p")" [ -z "$dood_link" ] || result_links="$(curl -A "$AGENT" -s "https://dood.ws${dood_link}" | sed -nE "s/.*window.open.*'(.*)',.*/\1/p")"
;; ;;
3) 3)
fb_id=$(printf "%s" "$links" | sed -n "s_.*fembed.*/v/__p") fb_id=$(printf "%s" "$links" | sed -n "s_.*fembed.*/v/__p")
refr="https://fembed-hd.com/v/$fb_id" refr="https://fembed-hd.com/v/$fb_id"
[ -z "$fb_id" ] || video_links="$(curl -A "$AGENT" -s -X POST "https://fembed-hd.com/api/source/$fb_id" -H "x-requested-with:XMLHttpRequest" | sed -e 's/\\//g' -e 's/.*data"://' | tr "}" "\n" | sed -nE 's/.*file":"(.*)","label":"(.*)","type.*/\2>\1/p')" [ -z "$fb_id" ] || result_links="$(curl -A "$AGENT" -s -X POST "https://fembed-hd.com/api/source/$fb_id" -H "x-requested-with:XMLHttpRequest" | sed -e 's/\\//g' -e 's/.*data"://' | tr "}" "\n" | sed -nE 's/.*file":"(.*)","label":"(.*)","type.*/\2>\1/p')"
;; ;;
*) *)
ajax_url="$BASE_URL/encrypt-ajax.php" ajax_url="$BASE_URL/encrypt-ajax.php"
@ -135,7 +135,7 @@ generate_link() {
token=$(printf "%s" "$resp" | sed -nE 's/.*data-value="(.*)">.*/\1/p' | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -nE 's/.*&(token.*)/\1/p') token=$(printf "%s" "$resp" | sed -nE 's/.*data-value="(.*)">.*/\1/p' | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -nE 's/.*&(token.*)/\1/p')
ajax=$(printf '%s' "$id" | openssl enc -e -aes256 -K "$secret_key" -iv "$iv" | base64) ajax=$(printf '%s' "$id" | openssl enc -e -aes256 -K "$secret_key" -iv "$iv" | base64)
data=$(curl -A "$AGENT" -s -H "X-Requested-With:XMLHttpRequest" "${ajax_url}?id=${ajax}&alias=${id}&${token}" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g') data=$(curl -A "$AGENT" -s -H "X-Requested-With:XMLHttpRequest" "${ajax_url}?id=${ajax}&alias=${id}&${token}" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
video_links="$(printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$second_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*')" result_links="$(printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$second_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*')"
;; ;;
esac esac
lg "END: generate_link()" > /dev/stderr lg "END: generate_link()" > /dev/stderr
@ -201,10 +201,12 @@ get_video_link() {
i=4 i=4
fi fi
links=$(printf "%s" "$resp" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/p') links=$(printf "%s" "$resp" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/p')
while [ -z "$video_links" ]; do while [ "$i" -ge 1 ] && [ "$i" -le 4 ] && [ -z "$result_links" ]; do
generate_link "$i" generate_link "$i"
[ "$is_download" -eq 1 ] && i=$((i + 1)) || i=$((i - 1)) [ "$is_download" -eq 1 ] && i=$((i + 1)) || i=$((i - 1))
done done
video_links="$result_links"
unset result_links
if printf '%s' "$video_links" | grep -q "m3u8"; then if printf '%s' "$video_links" | grep -q "m3u8"; then
is_m3u8=1 is_m3u8=1
video_url="$video_links" video_url="$video_links"