diff --git a/ani-cli b/ani-cli deleted file mode 100755 index 7c67e03..0000000 --- a/ani-cli +++ /dev/null @@ -1,263 +0,0 @@ -#!/bin/sh - -# dependencies: grep sed curl video_player -# video_player ( needs to be able to play urls ) -player_fn="mpv" -prog="ani-cli" -site="gogoanime.film" -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36" - -c_red="\033[1;31m" -c_green="\033[1;32m" -c_yellow="\033[1;33m" -c_blue="\033[1;34m" -c_magenta="\033[1;35m" -c_cyan="\033[1;36m" -c_reset="\033[0m" - -help_text () { - while IFS= read line; do - printf "%s\n" "$line" - done <<-EOF - USAGE: $prog - -h show this help text - -d download episode - EOF -} - -die () { - printf "$c_red%s$c_reset\n" "$*" >&2 - exit 1 -} - -err () { - printf "$c_red%s$c_reset\n" "$*" >&2 -} - -search_anime () { - # get anime name along with its id - search=$1 - curl -s "https://$site//search.html?keyword=$search" | sed -n -E ' - s_^[[:space:]]*/dev/null || die "Invalid number entered" - - # Select respective anime_id - count=1 - while read anime_id; do - if [ $count -eq $choice ]; then - selection_id=$anime_id - break - fi - count=$((count+1)) - done <<-EOF - $search_results - EOF - - [ -z "$selection_id" ] && die "Invalid number entered" - - read last_ep_number <<-EOF - $(search_eps "$selection_id") - EOF -} - -################## -## Ep selection ## -################## - -open_episode () { - anime_id=$1 - episode=$2 - - if [ $episode -lt 1 ] || [ $episode -gt $last_ep_number ]; then - err "Episode out of range" - printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number - read episode - printf "$c_reset" - fi - - printf "\nGetting data for episode %d\n" $episode - - embedded_url=$(embade_link "$anime_id" "$episode") - video_url=$(decrypt_link "$embedded_url") - printf "%s\n" "$embedded_url" - printf "%s\n" "$video_url" - - if [ $is_download -eq 0 ]; then - ([ -z $ep_choice_end ] && - setsid -f $player_fn --http-header-fields="User-Agent:$agent" --referrer="$embedded_url" "$video_url" >/dev/null 2>&1 || $player_fn --referrer="$embedded_url" "$video_url" >/dev/null 2>&1) - else - printf "Downloading episode $episode ...\n" - # add 0 padding to the episode name - episode=$(printf "%03d" $episode) - { - aria2c -x 16 -s 16 -U "$agent" --referer "$embedded_url" "$video_url" --dir=MOVIES -o "${anime_id}-${episode}.mp4" && - printf "${c_green}Downloaded episode: %s${c_reset}\n" "$episode" || - printf "${c_red}Download failed episode: %s${c_reset}\n" "$episode" - } - fi -} - -############ -# Start Up # -############ - -# to clear the colors when exited using SIGINT -trap "printf '$c_reset';exit 1" INT HUP - -# option parsing -is_download=0 -while getopts 'hdc' OPT; do - case $OPT in - h) - help_text - exit 0 - ;; - d) - is_download=1 - ;; - esac -done -shift $((OPTIND - 1)) - -######## -# main # -######## - -get_search_query "$*" -search_results=$(search_anime "$query") -[ -z "$search_results" ] && die "No search results found" -anime_selection "$search_results" -[ $is_download -eq 1 ] && printf "Range of episodes can be specified: start_number end_number\n" -printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number -read ep_choice_start ep_choice_end -printf "$c_reset" - -{ # checking input - [ "$ep_choice_start" -eq "$ep_choice_start" ] 2>/dev/null || die "Invalid number entered" - episodes=$ep_choice_start - - if [ -n "$ep_choice_end" ]; then - [ "$ep_choice_end" -eq "$ep_choice_end" ] 2>/dev/null || die "Invalid number entered" - # create list of episodes to download/watch - episodes=$(seq $ep_choice_start $ep_choice_end) - fi -} - -for ep in $episodes -do - open_episode "$selection_id" "$ep" -done -episode=${ep_choice_end:-$ep_choice_start} - -while :; do - printf "\n${c_green}Currently playing %s episode ${c_cyan}%d/%d\n" "$selection_id" $episode $last_ep_number - printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "n" "next episode" - printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "p" "previous episode" - printf "$c_blue[${c_cyan}%s$c_blue] $c_yellow%s$c_reset\n" "s" "select episode" - printf "$c_blue[${c_cyan}%s$c_blue] $c_magenta%s$c_reset\n" "r" "replay current episode" - printf "$c_blue[${c_cyan}%s$c_blue] $c_red%s$c_reset\n" "q" "exit" - printf "${c_blue}Enter choice:${c_green} " - read choice - printf "$c_reset" - case $choice in - n) - episode=$((episode + 1)) - open_episode "$selection_id" "$episode" - ;; - p) - episode=$((episode - 1)) - open_episode "$selection_id" "$episode" - ;; - - s) printf "${c_blue}Choose episode $c_cyan[1-%d]$c_reset:$c_green " $last_ep_number - read episode - printf "$c_reset" - [ "$episode" -eq "$episode" ] 2>/dev/null || die "Invalid number entered" - open_episode "$selection_id" "$episode" - ;; - - r) - episode=$((episode)) - open_episode "$selection_id" "$episode" - ;; - - q) - break;; - - *) - err "invalid choice" - ;; - esac - -done diff --git a/ani-new b/ani-new index c0a28f2..528137c 100755 --- a/ani-new +++ b/ani-new @@ -1,19 +1,26 @@ #!/bin/sh -agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36" decrypt_link() { - ajax_url='https://gogoplay.io/encrypt-ajax.php' - video_id=$(printf "$1" | cut -d\? -f2 | cut -d\& -f1 | sed 's/id=//g') - secret_key='3235373436353338353932393338333936373634363632383739383333323838' - iv='34323036393133333738303038313335' - ajax=$(printf "$video_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a) - curl -s -H "X-Requested-With:XMLHttpRequest" -H "User-Agent:$agent" -H "Referer:https:$1" "$ajax_url" -d "id=$ajax" -d "time=69420691337800813569" | jq -r '.source[].file' | head -4 | tail -1 + secret_key='3633393736383832383733353539383139363339393838303830383230393037' + iv='34373730343738393639343138323637' + ajax_url="https://gogoplay5.com/encrypt-ajax.php" + id=$(printf "%s" "$1" | sed -nE 's/.*id=(.*)&title.*/\1/p') + ajax=$(printf "%s" "$id" | openssl enc -e -aes256 -K "$secret_key" -iv "$iv" | base64) + data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g') + printf "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' | grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*' | head -4 | tail -1 } -notify-send -t 1000 "parsing gogoanime.... please wait!!" -url=$(curl -s -A "$agent" "https://gogoanime.film" | sed -nE 's/.*"name".*href="\/([^"]*)".*/\1/p' | dmenu -p "Select anime:") +notify-send -t 1000 "parsing gogoplay5.... please wait!!" +url=$(curl -s "https://gogoplay5.com" | sed -nE 's_.*_\1_p' | dmenu -l 15 -p "Select anime:") [ -z "$url" ] && notify-send -u critical "Err.. no anime selected" && exit 0 -refr=$(curl -s -A "$agent" "https://gogoanime.film/$url" | sed -n -E 's/^[[:space:]]*pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) { - XftFontClose(drw->dpy, xfont); - return NULL; - } - font = ecalloc(1, sizeof(Fnt)); font->xfont = xfont; font->pattern = pattern; diff --git a/dmenu-5.0/drw.o b/dmenu-5.0/drw.o index 769ec78..2b22ad3 100644 Binary files a/dmenu-5.0/drw.o and b/dmenu-5.0/drw.o differ diff --git a/rss b/rss index b7f8e88..decb25a 100755 --- a/rss +++ b/rss @@ -3,17 +3,17 @@ #script for downloading latest anime episode via torrent using rss provided by website named "subsplease.org" #parsing rss file notify-send -t 2000 "Parsing SubsPlease RSS... Please Wait..." -curl -s https://subsplease.org/rss/?r=1080 | tr "<" "\n" > $HOME/.cache/rss +data=$(curl -s "https://subsplease.org/rss/?r=1080" | tr "<|>" "\n") #extracting names and providing the menu for selecting particular title -name=$(sed -n -e 's/title>\[.*Please\] \(.*\)/\1/p' .cache/rss | dmenu -l 25 -p "Search anime:") +name=$(printf "%s" "$data" | sed -nE 's/^\[.*Please\] (.*)/\1/p' | dmenu -l 25 -p "Search anime:") [ -z "$name" ] && notify-send -u critical "Err.. Query empty" && exit 0 #extracting id from anime_name_[id].mkv id=$(printf "$name" | sed -n -e 's/.*\[\(.*\)\].*/\1/p') #finding the magnet link containing the exact pattern -magnet=$(sed -n -e "s/link>\(.*$id.*\).*/\1/p" .cache/rss | sed 's/amp;//g') +magnet=$(printf "%s" "$data" | grep "$id%" | sed 's/amp;//g') #custom script for downloading torrent using aria2c.. you can use your own bittorrent client here st -e $HOME/repos_scripts/torrent "$magnet" & diff --git a/tor-cli b/tor-cli index 44a9e04..6c64ba4 100755 --- a/tor-cli +++ b/tor-cli @@ -4,7 +4,7 @@ mkdir -p $HOME/.cache/pirokit query=$(printf "" | dmenu -p "Search Torrent: ") baseurl="https://www.1337xx.to" cachedir="$HOME/.cache/pirokit" -query="$(sed 's/ /+/g' <<<$query)" +query="$(sed 's/ /%20/g' <<<$query)" curl -s "$baseurl/search/$query/1/" > $cachedir/tmp.html # Get Titles diff --git a/youtube b/youtube index 5277239..ea6670b 100755 --- a/youtube +++ b/youtube @@ -26,8 +26,8 @@ part(){ printf "${c_yellow}Enter End Point(hh:mm:ss)or(mm:ss):${c_cyan}" read end [ -z "$2" ] && - ffmpeg -i $(yt-dlp -f b --get-url "$video") -ss $start -to $end "$HOME/Videos/%(title)s.mp4" || - ffmpeg -i $(yt-dlp -f 'ba' --get-url "$video") -ss $start -t $end -map a -q:a 0 "$HOME/Music/%(title)s.mp3" + ffmpeg -i $(yt-dlp -f b --get-url "$video") -ss $start -to $end "$HOME/Videos/$(date +%s).mp4" || + ffmpeg -i $(yt-dlp -f 'ba' --get-url "$video") -ss $start -t $end -map a -q:a 0 "$HOME/Music/$(date +%s).mp3" } #program starts from here..