#!/bin/sh down () { notify-send "$3 links fetched.." -r "$tmp" choice=$(printf "download\nwatch\nnext mirror" | bemenu --fn 'Roboto 15' -p "??" -i -c -W 0.4 -B 3 -l 10) [ "$choice" = "watch" ] && setsid -f mpv --referrer="$1" "$2" --force-media-title="$title" && notify-send -i "$icon_dir/apps/mpv.svg" "opening $title" -r "$tmp" && exit 0 [ "$choice" = "next mirror" ] && return 0 notify-send -i "$icon_dir/panel/jdownloader-indicator.svg" "Downloading $title" -r "$tmp" case $2 in *m3u*) $TERMINAL -e ffmpeg -loglevel error -stats -referer "$1" -user_agent "$agent" -i "$2" -c copy "$title.mp4" || (notify-send -u "critical" "Downloading failed $title" -r "$tmp" && exit 0) notify-send "Episode Downloaded $title" -r "$tmp" ;; *) $TERMINAL -e aria2c -U "$agent" --check-certificate=false --summary-interval=0 -x 16 -s 16 --referer="$1" "$2" -o "$title.mp4" --download-result=hide || (notify-send -u "critical" "Downloading failed $title" -r "$tmp" && exit 0) notify-send "Episode Downloaded $title" -r "$tmp" ;; esac exit 0 } provider_run(){ notify-send "Fetching $1 links" -r "$tmp" provider_id=$(printf "%s" "$data" | sed -n "$2" | head -1 | cut -d':' -f2) [ -z "$provider_id" ] && return 0 provider_video=$(curl -s "https://blog.allanime.pro/apivtwo/clock.json?id=$provider_id" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\1|p' | head -1) case $provider_video in *v.vrv.co*|*crunchyroll*) down "$base_url" "$(curl -s "$provider_video" -A "$agent" | sed 's|^#.*x||g; s|,.*|p|g; /^#/d; $!N; s|\n| >|; s|\/index-v1-a1\.m3u8||g' | grep -q "1080" | cut -d'>' -f2)" "$1" ;; *repackager.wixmp.com*) down "$base_url" "$(printf %s "$provider_video" | cut -d',' -f1,2 | tr -d ',' | sed 's|repackager.wixmp.com/||g')/mp4/file.mp4" "$1" ;; *) down "$base_url" "$provider_video" "$1" ;; esac } icon_dir="/usr/share/icons/Papirus/16x16" base_url="https://allanime.site" agent="uwu" trap "exit 0" INT HUP tmp=$(notify-send "Parsing $base_url.. Please wait..." -t 1500 -p) [ -z "$*" ] && url=$(curl -s "$base_url/anime" -A uwu | sed -nE 's|.*href="(/watch/[^"]*)" class.*|\1|p' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 20 -p "Select Anime: ") || url=$* title=$(printf "%s" "$url" | cut -d'/' -f4- | tr '[:punct:]' ' ') [ -z "$url" ] && notify-send -u "critical" "No anime selected" -r "$tmp" && exit 0 notify-send "Loading Episode $title.." -r "$tmp" data=$(curl -A "$agent" -s "${base_url}$url" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":".*?id=([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') notify-send "Fetching Embed links" -r "$tmp" #pstatic links provider_run "pstatic" "/Default B :/p" #vrv|wixmp links provider_run "vrv" "/Default :/p" #sharepoint links provider_run "sharepoint" "/S-mp4 :/p" #usercloud links provider_run "usercloud" "/Uv-mp4 :/p" #gogoplay links provider_run "gogoplay" "/Luf-mp4 :/p" id=$(printf "%s" "$data" | sed -nE 's/Vid-mp4 :([^&]*).*/\1/p') [ -z "$id" ] && notify-send -u critical "no more mirror links..sorry" -r "$tmp" && exit 0 resp="$(curl -A "$agent" -s "https://gogohd.pro/streaming.php?id=$id" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/p')" notify-send "Fetching mp4upload links" -r "$tmp" mp4up_link=$(printf "%s" "$resp" | grep "mp4upload") [ -z "$mp4up_link" ] || mp4up_video=$(curl -A "$agent" -s "$mp4up_link" -H "DNT: 1" --connect-timeout=10 | sed -nE 's_.*embed\|(.*)\|.*blank.*\|(.*)\|(.*)\|(.*)\|(.*)\|src.*_https://\1.mp4upload.com:\5/d/\4/\3.\2_p') [ -z "$mp4up_video" ] || down "$mp4up_link" "$mp4up_video" "mp4upload" notify-send "Fetching xstreamcdn links" -r "$tmp" fb_id=$(printf "%s" "$resp" | sed -n "s_.*fembed.*/v/__p") [ -z "$fb_id" ] || fb_video=$(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.*/\1/p' | tail -1) [ -z "$fb_video" ] || down "https://fembed-hd.com/v/$fb_id" "$fb_video" "xstreamcdn" notify-send -u critical "no more mirror links..sorry" -r "$tmp" && exit 0