update providers list and fix mp4 quality selection

This commit is contained in:
ksyasuda 2022-09-04 01:12:26 -07:00
parent 2c7789c58f
commit 98cddd04a0
2 changed files with 19 additions and 51 deletions

59
ani-cli
View File

@ -126,56 +126,17 @@ download() {
generate_link() { generate_link() {
case $1 in case $1 in
1) 1)
progress "Fetching Mp4upload links.." provider_name='Xstreamcdn'
refr=$(printf "%s" "$al_links" | grep "mp4upload") progress "Fetching $provider_name links.."
[ -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.."
fb_id=$(printf "%s" "$resp" | sed -n "s_.*fembed.*/v/__p") fb_id=$(printf "%s" "$resp" | 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" ] && return 0 [ -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" | 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')" sed -e 's/\\//g' -e 's/.*data"://' | tr "}" "\n" | sed -nE 's/.*file":"(.*)","label":"(.*)","type.*/\2>\1/p')"
;; ;;
6) 2)
progress "Fetching Animixplay Direct links.." provider_name='Animixplay'
progress "Fetching $provider_name Direct link.."
refr="$BASE_URL" refr="$BASE_URL"
[ -z "$id" ] && return 0 [ -z "$id" ] && return 0
enc_id=$(printf "%s" "$id" | base64) 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)" 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" refr="https://goload.pro"
[ -z "$id" ] && return 0 [ -z "$id" ] && return 0
secret_key=$(printf "%s" "$resp" | sed -n '2p' | tr -d "\n" | od -A n -t x1 | tr -d " |\n") 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@:%_\+.~#?&\/\/=]*')" sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*')"
;; ;;
esac esac
printf '%s' "$video_url"
} }
get_video_quality_mp4() { get_video_quality_mp4() {
@ -265,8 +228,10 @@ get_video_link() {
: $((i += 1)) : $((i += 1))
done done
if printf '%s' "$result_links" | grep -q "m3u8"; then if printf '%s' "$result_links" | grep -q "m3u8"; then
IS_MP4=0
get_video_quality_m3u8 "$result_links" get_video_quality_m3u8 "$result_links"
else else
IS_MP4=1
video_url=$(get_video_quality_mp4 "$result_links") video_url=$(get_video_quality_mp4 "$result_links")
fi fi
unset result_links unset result_links
@ -533,7 +498,9 @@ parse_args() {
;; ;;
P) P)
select_provider="$OPTARG" 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" inf "Invalid option"

View File

@ -259,7 +259,7 @@ get_player() {
# prompts the user to select a provider and returns the provider name and index # prompts the user to select a provider and returns the provider name and index
get_provider() { 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 if ((IS_ROFI)); then
selection="$(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \ selection="$(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \
-i -l 7 -theme-str 'listview {columns: 1;} window {width: 45%;}' \ -i -l 7 -theme-str 'listview {columns: 1;} window {width: 45%;}' \
@ -268,11 +268,13 @@ get_provider() {
[ -z "$selection" ] && selection=1 [ -z "$selection" ] && selection=1
provider_idx="${selection:0:1}" provider_idx="${selection:0:1}"
else else
provider_begin=1
provider_end=3
printf "%s%s\n" "Select provider:" "[$providers]" printf "%s%s\n" "Select provider:" "[$providers]"
prompt "Enter provider [1-7]" prompt "Enter provider [$provider_begin-$provider_end]"
read -r provider_idx read -r provider_idx
[ -z "$provider_idx" ] && die "ERROR: provider index cannot be empty" [ -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 fi
while IFS='|' read -ra providers_list; do while IFS='|' read -ra providers_list; do
for p in "${providers_list[@]}"; do for p in "${providers_list[@]}"; do
@ -284,7 +286,7 @@ get_provider() {
((++idx)) ((++idx))
done done
done <<< "$providers" done <<< "$providers"
[ -z "$provider" ] && provider="mp4upload" [ -z "$provider" ] && provider="Xstreamcdn"
inf "Selected provider: $provider" inf "Selected provider: $provider"
} }
@ -332,7 +334,6 @@ check_flags() {
if ((SELECT_PROVIDER)); then if ((SELECT_PROVIDER)); then
get_provider || provider_idx=1 get_provider || provider_idx=1
lg "PROVIDER INDEX -> $provider_idx" lg "PROVIDER INDEX -> $provider_idx"
lg "SELECTED PROVIDER -> $provider"
args+=(-P"$provider_idx") args+=(-P"$provider_idx")
fi fi
if ((SILENT)); then if ((SILENT)); then