From 6007f6baf62c13208b3678c15f4dad6148a9f073 Mon Sep 17 00:00:00 2001 From: coolnsx Date: Tue, 10 Jan 2023 00:55:57 +0530 Subject: [PATCH] Fuck it, YOLO! --- ani-new | 87 +++++++++++++++++++++++++++++++++----------------------- yt-music | 6 ++-- 2 files changed, 55 insertions(+), 38 deletions(-) diff --git a/ani-new b/ani-new index 3ade5e0..c3b8117 100755 --- a/ani-new +++ b/ani-new @@ -1,56 +1,73 @@ #!/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.6 -B 3 -l 10) - [ "$choice" = "watch" ] && setsid -f mpv --referrer="$1" "$2" --force-media-title="$url" && notify-send -i "$icon_dir/apps/mpv.svg" "opening $url" -r $tmp && exit 0 + 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 $url" -r $tmp + 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 "$url.mp4" && notify-send "Episode Downloaded $url" -r $tmp || (notify-send -u "critical" "Downloading failed $url" -r $tmp && exit 0);; - *) - $TERMINAL -e aria2c -U "$agent" --check-certificate=false --summary-interval=0 -x 16 -s 16 --referer="$1" "$2" -o "$url.mp4" --download-result=hide && notify-send "Episode Downloaded $url" -r $tmp || (notify-send -u "critical" "Downloading failed $url" -r $tmp && exit 0);; + *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 } -run () { - curl -s "$base_url?page=1" -A "$agent" | sed -nE 's_.*_\1_p' & - curl -s "$base_url?page=2" -A "$agent" | sed -nE 's_.*_\1_p' & +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://gogohd.net" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36" +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=$(run | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 20 -p "Select Anime: ") || url=$* -[ -z "$url" ] && notify-send -u "critical" "No anime selected" -r $tmp && exit 0 || notify-send "Loading Episode $url.." -r $tmp -refr=$(curl -A "$agent" -s "$base_url/videos/$url" | sed -nE 's/.*iframe src="(.*)" al.*/\1/p') -notify-send "Fetching Embed links" -r $tmp -resp="$(curl -A "$agent" -s "https:$refr" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/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" -notify-send "Fetching mp4upload links" -r $tmp -mp4up_link=$(printf "$resp" | grep "mp4upload") +#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 doodstream links" -r $tmp -dood_id=$(printf "$resp" | sed -n "s_.*dood.*/e/__p") -[ -z "$dood_id" ] || dood_link=$(curl --cipher AES256-SHA256 --tls-max 1.2 -s -A "$agent" "https://dood.ws/e/$dood_id" | sed -nE ".*(/pass_md5[^']*)',.*|\1|p") -[ -z "$dood_link" ] || dood_video="$(curl --cipher AES256-SHA256 --tls-max 1.2 -s -A "$agent" "https://dood.ws${dood_link}" -e "https://dood.ws/e/$dood_id")" -[ -z "$dood_video" ] || down "https://dood.ws/d/$dood_id" "${dood_video}doodstream?token=$(printf "%s" "$dood_link" | cut -d "/" -f4)&expiry=$(date +'%s%3N')" "doodstream" - -notify-send "Fetching xstreamcdn links" -r $tmp -fb_id=$(printf "$resp" | sed -n "s_.*fembed.*/v/__p") +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" -id=$(printf "%s" "$refr" | sed -nE 's/.*id=(.*)&title.*/\1/p') - -notify-send "Fetching animixplay links" -r $tmp -[ -z "$id" ] || ani_video="$(curl -s "https://animixplay.to/api/live$(printf "%sLTXs3GrU8we9O%s" "$id" "$(printf "$id" | base64)" | base64)" -A "$agent" -I | sed -nE 's_location: (.*)_\1_p' | cut -d"#" -f2 | base64 -d)" -[ -z "$ani_video" ] || down "https://animixplay.to" "$ani_video" "animixplay" - -notify-send -u critical "no more mirror links..sorry" -r $tmp && exit 0 +notify-send -u critical "no more mirror links..sorry" -r "$tmp" && exit 0 diff --git a/yt-music b/yt-music index 551b68e..ec67bcf 100755 --- a/yt-music +++ b/yt-music @@ -118,7 +118,7 @@ play(){ printf "Audio URL >> %s\n" "$audio_url" fi - curl -s "https://i.ytimg.com/vi/$id/hqdefault.jpg" -o - | convert - -crop 270x270+105+45 "$logdir/default.jpg" && notify-send -i "$logdir/default.jpg" "Now Playing" "$title" -t 5000 + curl -s "https://i.ytimg.com/vi/$id/hqdefault.jpg" -o - | convert - -crop 270x270+105+45 "$logdir/default.jpg" && notify-send -r 5 -i "$logdir/default.jpg" "Now Playing" "$title" -t 5000 pgrep -f "mpvsocket" > /dev/null || (setsid -f mpv --really-quiet --input-ipc-server=/tmp/mpvsocket --idle --quiet >/dev/null && sleep 1) echo "{ \"command\": [\"loadfile\", \"$audio_url\", \"replace\"] }" | socat - /tmp/mpvsocket cut -d':' -f2 "$logdir/current" > "$logdir/prev" @@ -141,7 +141,7 @@ search_play(){ #run this if u r starting the script first time like this #call this by "script-name" "search_play" "search_query" [ -z "$1" ] && query=$(:| menu "Yt-music [Search]: ") || query="$1" - [ -z "$query" ] && notify-send "Err.. Search query empty" -u critical && exit 1 + [ -z "$query" ] && notify-send "Err.. Search query empty" -u critical -r 5 && exit 1 curl -A "$agent" -s "$base_url/" -c "$cookie" | sed -nE 's|.*INNERTUBE_CONTEXT":(.*),"INNERTUBE_CONTEXT_CLIENT_NAME.*|\1|p' > "$logdir/context" json_search="{ @@ -157,7 +157,7 @@ play_next(){ #call this by script-name "play_next" for playing next song immediately #or add "menu" after "play_next" to show menu for selecting and playing next song immediately #like this script-name "play_next" "menu" - [ -z "$1" ] && play "$(shuf -n1 "$logdir/next")" "verbose" || (pgrep -f "mpvsocket" && notify-send -i "$logdir/default.jpg" "$(cut -d">" -f1 "$logdir/current" | tr ':' '\n')" && play "$(menu "YT-music [play-next]: " < "$logdir/next")" "verbose") + [ -z "$1" ] && play "$(shuf -n1 "$logdir/next")" "verbose" || (pgrep -f "mpvsocket" && notify-send -r 5 -i "$logdir/default.jpg" "$(cut -d">" -f1 "$logdir/current" | tr ':' '\n')" && play "$(menu "YT-music [play-next]: " < "$logdir/next")" "verbose") } menu(){