diff --git a/ani-cli b/ani-cli index 0623dfb..70d829e 100755 --- a/ani-cli +++ b/ani-cli @@ -126,56 +126,17 @@ download() { generate_link() { case $1 in 1) - progress "Fetching Mp4upload links.." - refr=$(printf "%s" "$al_links" | grep "mp4upload") - [ -z "$refr" ] && refr=$(printf "%s" "$resp" | grep "mp4upload") - [ -z "$refr" ] && return 0 - result_links="$(curl -A "$AGENT" -s "$refr" -H "DNT: 1" -L | - sed -nE 's_.*embed\|(.*)\|.*blank.*\|(.*)\|(.*)\|(.*)\|(.*)\|src.*_https://\1.mp4upload.com:\5/d/\4/\3.\2_p')" - ;; - 2) - progress "Fetching Doodstream links.." - dood_id=$(printf "%s" "$al_links" | sed -n "s_.*dood.*/e/__p") - [ -z "$dood_id" ] && dood_id=$(printf "%s" "$resp" | sed -n "s_.*dood.*/e/__p") - refr="https://dood.pm/e/$dood_id" - [ -z "$dood_id" ] || dood_md5=$(curl -A "$AGENT" -s "$refr" --max-time 10 | sed -nE "s|.*'(.*pass_md5.*)', func.*|\1|p") - [ -z "$dood_md5" ] && return 0 - result_links="$(curl -A "$AGENT" -s "https://dood.pm${dood_md5}" -e "$refr" || true)doodstream?token=$(printf "%s" "$dood_md5" | cut -d'/' -f4 || true)&expiry=$(date +%s)000" - ;; - 3) - progress "Fetching Streamlare links.." - lare_id=$(printf "%s" "$al_links" | sed -nE 's_.*streamlare.*/e/(.*)_\1_p') - [ -z "$lare_id" ] && lare_id=$(printf "%s" "$dpage_url" | sed -nE 's_.*streamlare.*/e/(.*)_\1_p') - refr="https://streamlare.com/e/$lare_id" - [ -z "$lare_id" ] && return 0 - lare_token=$(curl -s -A "$AGENT" "$refr" -L | sed -nE 's/.*csrf-token.*content="(.*)">/\1/p') - [ -z "$lare_token" ] || result_links="$(curl -s -A "$AGENT" -H "x-requested-with:XMLHttpRequest" -X POST "https://streamlare.com/api/video/download/get" -d "{\"id\":\"$lare_id\"}" \ - -H "x-csrf-token:$lare_token" -H "content-type:application/json;charset=UTF-8" | sed 's/\\//g' | sed -nE 's/.*url":"([^"]*)".*/\1/p')" - ;; - 4) - progress "Fetching Okru links.." - ok_id=$(printf "%s" "$al_links" | sed -nE 's_.*ok.*videoembed/(.*)_\1_p') - [ -z "$ok_id" ] && ok_id=$(printf "%s" "$dpage_url" | sed -nE 's_.*ok.*videoembed/(.*)_\1_p') - refr="https://odnoklassniki.ru/videoembed/$ok_id" - [ -z "$ok_id" ] && return 0 - result_links="$(curl -s "$refr" | sed -nE 's_.*data-options="([^"]*)".*_\1_p' | sed -e 's/"/"/g' -e 's/\u0026/\&/g' -e 's/amp;//g' | sed 's/\\//g' | sed -nE 's/.*videos":(.*),"metadataE.*/\1/p' | tr '{|}' '\n' | - sed -nE 's/"name":"mobile","url":"(.*)",.*/144p >\1/p ; - s/"name":"lowest","url":"(.*)",.*/240p >\1/p ; - s/"name":"low","url":"(.*)",.*/360p >\1/p ; - s/"name":"sd","url":"(.*)",.*/480p >\1/p ; - s/"name":"hd","url":"(.*)",.*/720p >\1/p ; - s/"name":"full","url":"(.*)",.*/1080p >\1/p')" - ;; - 5) - progress "Fetching Xstreamcdn links.." + provider_name='Xstreamcdn' + progress "Fetching $provider_name links.." fb_id=$(printf "%s" "$resp" | sed -n "s_.*fembed.*/v/__p") refr="https://fembed-hd.com/v/$fb_id" [ -z "$fb_id" ] && return 0 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')" ;; - 6) - progress "Fetching Animixplay Direct links.." + 2) + provider_name='Animixplay' + progress "Fetching $provider_name Direct link.." refr="$BASE_URL" [ -z "$id" ] && return 0 enc_id=$(printf "%s" "$id" | base64) @@ -183,7 +144,8 @@ generate_link() { result_links="$(curl -s "$BASE_URL/api/live${ani_id}" -A "$AGENT" -I | sed -nE 's_location: (.*)_\1_p' | cut -d"#" -f2 | base64 -d)" ;; *) - progress "Fetching Goload Direct links.." + provider_name='Gogoanime' + progress "Fetching $provider_name Direct link.." refr="https://goload.pro" [ -z "$id" ] && return 0 secret_key=$(printf "%s" "$resp" | sed -n '2p' | tr -d "\n" | od -A n -t x1 | tr -d " |\n") @@ -196,6 +158,7 @@ generate_link() { sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*')" ;; esac + printf '%s' "$video_url" } get_video_quality_mp4() { @@ -265,8 +228,10 @@ get_video_link() { : $((i += 1)) done if printf '%s' "$result_links" | grep -q "m3u8"; then + IS_MP4=0 get_video_quality_m3u8 "$result_links" else + IS_MP4=1 video_url=$(get_video_quality_mp4 "$result_links") fi unset result_links @@ -533,7 +498,9 @@ parse_args() { ;; P) select_provider="$OPTARG" - ((select_provider < 1 || select_provider > 7)) && die "Invalid provider: $select_provider" + provider_begin=1 + provider_end=3 + ((select_provider < provider_begin || select_provider > provider_end)) && die "Invalid provider: $select_provider" ;; *) inf "Invalid option" diff --git a/aniwrapper b/aniwrapper index a41facd..4739968 100755 --- a/aniwrapper +++ b/aniwrapper @@ -259,7 +259,7 @@ get_player() { # prompts the user to select a provider and returns the provider name and index get_provider() { - providers="1. Mp4upload|2. Doodstream|3. Streamlare|4. Okru|5. Xstreamcdn|6. Animixplay|7. Gogoanime" + providers="1. Xstreamcdn|2. Animixplay|3. Gogoanime" if ((IS_ROFI)); then selection="$(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \ -i -l 7 -theme-str 'listview {columns: 1;} window {width: 45%;}' \ @@ -268,11 +268,13 @@ get_provider() { [ -z "$selection" ] && selection=1 provider_idx="${selection:0:1}" else + provider_begin=1 + provider_end=3 printf "%s%s\n" "Select provider:" "[$providers]" - prompt "Enter provider [1-7]" + prompt "Enter provider [$provider_begin-$provider_end]" read -r provider_idx [ -z "$provider_idx" ] && die "ERROR: provider index cannot be empty" - ((provider_idx < 1 || provider_idx > 7)) && die "ERROR: provider index must be between 1 and 7" + ((provider_idx < provider_begin || provider_idx > provider_end)) && die "ERROR: provider index must be between $provider_begin and $provider_end" fi while IFS='|' read -ra providers_list; do for p in "${providers_list[@]}"; do @@ -284,7 +286,7 @@ get_provider() { ((++idx)) done done <<< "$providers" - [ -z "$provider" ] && provider="mp4upload" + [ -z "$provider" ] && provider="Xstreamcdn" inf "Selected provider: $provider" } @@ -332,7 +334,6 @@ check_flags() { if ((SELECT_PROVIDER)); then get_provider || provider_idx=1 lg "PROVIDER INDEX -> $provider_idx" - lg "SELECTED PROVIDER -> $provider" args+=(-P"$provider_idx") fi if ((SILENT)); then