diff --git a/.functions b/.functions new file mode 100644 index 0000000..e6b1ec9 --- /dev/null +++ b/.functions @@ -0,0 +1,49 @@ +#!/bin/sh + +menu_droid () { + fzf --prompt="$1" +} + +menu_linux () { + bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 25 -p "$1" +} + +search_droid () { + printf "$1" && read -r query +} + +search_linux () { + query=$(: | menu_linux "$1 ") +} + +torrent_linux () { + setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$1" +} + +torrent_droid () { + $HOME/torrent "$1" +} + +info_droid () { + printf "\n\r\033[1;36m%s" "$1" +} + +info_linux () { + notify-send "$1" -r '10' -i "$2" +} + +error_droid () { + printf "\33[2K\r\033[1;31m%s" "$1" +} + +error_linux () { + notify-send -u "critical" "$1" -r '10' +} + +player_droid () { + am start --user 0 -a android.intent.action.VIEW -d "$1" -n is.xyz.mpv/.MPVActivity >/dev/null 2>&1 +} + +player_linux () { + setsid -f mpv "$1" --force-media-title="$2" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..66763a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +.bash_history +.hushlogin +dis-bot +bruh* +.lesshst +.mysql_history +.python_history +y +x +dl +ndl +bench +.zcompdump +.cache/ +dra-cla/ +lol*/ +.npm/ +.npmrc +hls +.config/ +.ipython/ +.local/ +.termux/ +storage/ +website +token +.gitconfig +.histfile +.ssh/ +.termux_authinfo +.shortcuts +BB90-191C +temp* +revanced* +sh-dlp diff --git a/ani-new b/ani-new index 077b272..c73d5ac 100755 --- a/ani-new +++ b/ani-new @@ -1,24 +1,25 @@ #!/bin/sh down () { - notify-send "$3 links fetched.." -r "$tmp" + info_$os "$3 links fetched.." choice=$(printf "stream\ndownload\nnext mirror" | bemenu --fn 'Roboto 15' -p "??" -i -c -W 0.4 -B 3 -l 10) - [ "$choice" = "stream" ] && setsid -f mpv "$2" --force-media-title="$title" && notify-send -i "$icon_dir/apps/mpv.svg" "opening $title" -r "$tmp" && exit 0 + [ -z "$choice" ] && exit 0 + [ "$choice" = "stream" ] && player_$os "$2" "$title" && info_$os "opening $title" "$icon_dir/apps/mpv.svg" && exit 0 [ "$choice" = "next mirror" ] && return 0 - notify-send -i "$icon_dir/panel/jdownloader-indicator.svg" "Downloading $title" -r "$tmp" + info_$os "Downloading $title" "$icon_dir/panel/jdownloader-indicator.svg" case $2 in - *m3u*) $TERMINAL -e hls -ro "Downloads/$title.mp4" "$2" || (notify-send -u "critical" "Downloading failed $title" -r "$tmp" && exit 0) ;; - *) $TERMINAL -e aria2c -U "$agent" --check-certificate=false -d 'Downloads' --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) ;; + *m3u*) $terminal hls -ro "$download_dir/$title.mp4" "$2" || (error_$os "Downloading failed $title" && exit 0) ;; + *) $terminal aria2c -U "$agent" --check-certificate=false -d "$download_dir" --summary-interval=0 -x 16 -s 16 --referer="$1" "$2" -o "$title.mp4" --download-result=hide || (error_$os "Downloading failed $title" && exit 0) ;; esac - notify-send "Episode Downloaded $title" -r "$tmp" + info_$os "Episode Downloaded $title" exit 0 } provider_run(){ - notify-send "Fetching $1 links" -r "$tmp" + info_$os "Fetching $1 links" 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;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p' | head -1) + provider_video=$(curl -s "https://allanimenews.com/apivtwo/clock.json?id=$provider_id" | sed 's|},{|\n|g' | sed -nE 's|.*link":"([^"]*)".*"resolutionStr":"([^"]*)".*|\1|p;s|.*hls","url":"([^"]*)".*"hardsub_lang":"en-US".*|\1|p' | head -1) [ -z "$provider_video" ] && return 0 case $provider_video in *crunchyroll*) down "$base_url" "$(curl -s "$provider_video" -A "$agent" | sed -n '/x1080/{n;p;}')" "$1" ;; @@ -28,17 +29,33 @@ provider_run(){ } icon_dir="/usr/share/icons/Papirus/16x16" -base_url="https://allanime.site" +base_url="https://api.allanime.to" agent="Mozilla/5.0" + +case $(uname -o) in + *ndroid*) + os="droid" + download_dir="/sdcard" + script_dir="$HOME" + ;; + *) + os="linux" + terminal="$TERMINAL -e" + script_dir="$HOME/repos_scripts" + ;; +esac + +. $script_dir/.functions trap "exit 0" INT HUP -tmp=$(notify-send "Parsing $base_url.. Please wait..." -t 1500 -p) -[ -z "$*" ] && url=$(curl -s "$base_url/allanimeapi?variables=%7B%22search%22%3A%7B%22sortBy%22%3A%22Recent%22%2C%22allowAdult%22%3Atrue%2C%22allowUnknown%22%3Atrue%7D%2C%22limit%22%3A40%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%2C%22countryOrigin%22%3A%22JP%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229c7a8bc1e095a34f2972699e8105f7aaf9082c6e1ccd56eab99c2f1a971152c6%22%7D%7D" -A "$agent" | sed 's|Show|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2\tepisode \3|p' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 20 -p "Select Anime: " | tr '[:punct:]' ' ' | tr -s ' ' | tr ' \t' '-/') || url=$(printf "%s" "$*" | sed -nE 's|.*/watch/(.*)-sub|\1|p') -[ -z "$url" ] && notify-send -u "critical" "No anime selected" -r "$tmp" && exit 0 -title=$(printf "%s" "$url" | cut -d'/' -f2- | tr '[:punct:]' ' ') -url=$(printf "%s" "$url" | cut -d'/' -f1,3) -notify-send "Loading Episode $title.." -r "$tmp" -data=$(curl -A "$agent" -s "${base_url}/watch/$url-sub" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":".*?id=([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') -notify-send "Fetching Embed links" -r "$tmp" +info_$os "Parsing $base_url.. Please wait..." +[ -z "$*" ] && url=$(curl -s "$base_url/allanimeapi?variables=%7B%22search%22%3A%7B%22sortBy%22%3A%22Recent%22%2C%22allowAdult%22%3Atrue%2C%22allowUnknown%22%3Atrue%7D%2C%22limit%22%3A40%2C%22page%22%3A1%2C%22translationType%22%3A%22sub%22%2C%22countryOrigin%22%3A%22JP%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%22c4305f3918591071dfecd081da12243725364f6b7dd92072df09d915e390b1b7%22%7D%7D" "$base_url/allanimeapi?variables=%7B%22search%22%3A%7B%22sortBy%22%3A%22Recent%22%2C%22allowAdult%22%3Atrue%2C%22allowUnknown%22%3Atrue%7D%2C%22limit%22%3A40%2C%22page%22%3A2%2C%22translationType%22%3A%22sub%22%2C%22countryOrigin%22%3A%22JP%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%22c4305f3918591071dfecd081da12243725364f6b7dd92072df09d915e390b1b7%22%7D%7D" -A "$agent" | sed 's|Show|\n|g' | sed -nE 's|.*_id":"([^"]*)","name":"([^"]*)".*sub":\{"episodeString":"([^"]*)".*|\1\t\2 Episode \3|p' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 20 -p "Select Anime: " | tr '[:punct:]' ' ' | tr -s ' ') || url=$(printf "%s" "$*" | sed -nE 's|.*/watch/(.*)-sub|\1|p') +[ -z "$url" ] && error_$os "No anime selected" && exit 0 +title=$(printf "%s" "$url" | cut -f2-) +id=$(printf "%s" "$url" | cut -f1) +ep_no=$(printf "%s" "$url" | sed 's/.*Episode //g') +info_$os "Loading Episode $title.." +data=$(curl -A "$agent" -s "$base_url/allanimeapi?variables=%7B%22showId%22%3A%22$id%22%2C%22translationType%22%3A%22sub%22%2C%22countryOrigin%22%3A%22ALL%22%2C%22episodeString%22%3A%22$ep_no%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%22919e327075ac9e249d003aa3f804a48bbdf22d7b1d107ffe659accd54283ce48%22%7D%7D" | tr '{}' '\n' | sed 's|\\u002F|\/|g;s|\\||g' | sed -nE 's|.*sourceUrl":".*?id=([^"]*)".*sourceName":"([^"]*)".*|\2 :\1|p') +info_$os "Fetching Embed links" #pstatic links provider_run "pstatic" "/Default B :/p" @@ -58,18 +75,18 @@ 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')" +id=$(printf "%s" "$data" | sed -nE 's/Vid-mp4 :(.*)/\1/p') +[ -z "$id" ] && error_$os "no more mirror links..sorry" && exit 0 +resp="$(curl -A "$agent" -s "https://anihdplay.com/streaming.php?id=$id" | sed -nE 's/.*data-status="1".*data-video="(.*)">.*/\1/p')" -notify-send "Fetching mp4upload links" -r "$tmp" +info_$os "Fetching mp4upload links" mp4up_link=$(printf "%s" "$resp" | grep "mp4upload") [ -z "$mp4up_link" ] || mp4up_video=$(curl -A "$agent" -s "$mp4up_link" -H "DNT: 1" | 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" +info_$os "Fetching xstreamcdn links" 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 +error_$os "no more mirror links..sorry" && exit 0 diff --git a/bkmark b/bkmark deleted file mode 100755 index c0eb3e2..0000000 --- a/bkmark +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -#script for bookmarking selected items and later using it.. - -data="$(wl-paste -p | tr '\n' '\`' | sed 's/$/ /g')" - -file="$HOME/.cache/bookmarks" -oshi_file="$HOME/.cache/oshi-urls" - -if [ "$*" = "add" ];then - if [ -z "$data" ];then - notify-send "Please select anything to bookmark" - elif grep -q "${data}" "$file";then - notify-send "Already bookmarked" - else - printf "%s" "$data" >> "$file" - notify-send "Bookmarked" "$data" - fi -elif [ "$*" = "rm" ];then - data="$(sed '/^$/d' "$file" | nl -n'ln')" - [ -z "$data" ] && notify-send "Bookmark is empty" && exit 0 - del=$(printf "%s" "$data" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "delete-bookmark :" | cut -f1) - [ -z "$del" ] || (sed -i "${del}d" "$file" && notify-send "Bookmarked deleted") -else - wtype -d 10 "$(sed '/^$/d' "$file" "$oshi_file" | sed -E 's/.*DL: ([^|]*).*/\1/g' | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 30 -p "Put-bookmark :" | tr '\`' '\n')" -fi - -sed -i '/^$/d' "$file" -printf "\n" >> "$file" diff --git a/fap-cli b/fap-cli new file mode 100755 index 0000000..bbcc84e --- /dev/null +++ b/fap-cli @@ -0,0 +1,165 @@ +#!/bin/sh + +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 -r line; do + printf "%s\n" "$line" + done <<-EOF + Usage: + ${0##*/} [-d | -p ] [] + ${0##*/} [-v] [] + ${0##*/} -h + + Options: + -h show helptext + -d download video + -p download video to specified directory + -v use VLC as the media player + EOF +} + +err () { + printf "$c_red%s$c_reset\n" "$*" >&2 +} + +get_query () { + [ -z "$*" ] && printf "${c_green}Search>${c_reset} " && read -r query || query=$* + query=$(printf "%s" "$query" | tr " " "+") +} + +input() { + printf "$c_yellow Episode??(1-%s)>$c_reset " "$1" + read -r x + while [ -z "$x" ] || ! [ "$x" -eq "$x" ] 2>/dev/null || [ "$x" -lt "1" ] 2>/dev/null || [ "$x" -gt "$1" ] 2>/dev/null ;do + err "Invalid choice" + printf "$c_yellow Episode??(1-%s)>$c_reset " "$1" + read -r x + done + ep_no=$x + unset x +} + +stream () { + case $player_fn in + vlc) + uname -a | grep -qE "[Aa]ndroid" && am start --user 0 -a android.intent.action.VIEW -d "$1" -n org.videolan.vlc/org.videolan.vlc.gui.video.VideoPlayerActivity -e "title" "$2" > /dev/null 2>&1 || setsid -f "$player_fn" --http-referrer="$base_url" "$1" > /dev/null 2>&1;; + mpv) + uname -a | grep -qE "[Aa]ndroid" && am start --user 0 -a android.intent.action.VIEW -d "$1" -n is.xyz.mpv/.MPVActivity > /dev/null 2>&1 || setsid -f "$player_fn" "$1" --referrer="$base_url" --force-media-title="$2" > /dev/null 2>&1;; + esac +} + +download () { + printf "${c_blue}Downloading %s${c_reset}\n" "$2" + case $1 in + *m3u8) + ffmpeg -loglevel error -stats -referer "$base_url" -i "$1" -c copy "$download_dir/$u2.mp4";; + *) + aria2c --summary-interval=0 -x 16 -s 16 --referer="$base_url" "$1" --dir=$download_dir -o "$2.mp4" --download-result=hide;; + esac +} + +get_show() { + printf "${c_blue}Searching query.." + results=$(curl -s "$base_url/?s=$query" | sed -nE 's_^[[:space:]]*.$_\1_p') + [ -z "$results" ] && printf "\33[2K\r${c_red}No search results found${c_reset}" && exit 0 + printf "\33[2K\r${c_green}Results found\n" + result=$(printf "%s" "$results" | fzf --layout="reverse" --border --height=10) + [ -z "$result" ] && err "No hentai selected" && exit 0 + printf "${c_magenta}selected $result\n${c_blue}Fetching episode list" + ep_list=$(curl -s "$base_url/tvshows/$result/" | sed -nE 's_^[[:space:]]*.$_\1_p' | tac) + noofeps=$(printf "%s\n" "$ep_list" | wc -l) + printf "\33[2K\r${c_green}Episodes list fetched\n" + [ "$noofeps" -eq 1 ] && ep_no=1 || input "$noofeps" + get_ep_link +} + +get_ep_link(){ + tput clear + printf "${c_blue}Loading Episode $ep_no" + ep_id=$(printf "%s" "$ep_list" | sed -n "${ep_no}p") + id=$(curl -s "$base_url/$ep_id/" | sed -nE "s/.*?p=(.*)'.*/\1/p") + display=$(printf "%s" "$ep_id" | cut -d'/' -f2- | tr "-" " ") + [ -z "$id" ] && printf "\33[2K\r${c_red}Episode doesn't exist on this site${c_reset}" || play_link +} + +play_link() { + printf "\33[2K\r${c_blue}Fetching video link" + data="$(curl -s "$(curl -s "$base_url/wp-admin/admin-ajax.php" -d "action=get_player_contents&a=$id" -H "X-Requested-With:XMLHttpRequest" | tr -d '\\' | sed -nE 's/.*src="(.*)" width.*,.*/\1/p')")" + video_link="$(printf "%s" "$data" | sed -nE 's/[[:space:]]*$c_reset " + read choice + case $choice in + d) + download "$video_link" "$display";; + n) + ep_no=$((ep_no + 1)) + [ "$ep_no" -gt "$noofeps" ] && err "Episode out of range" && ep_no=$((ep_no-1)) || get_ep_link;; + p) + ep_no=$((ep_no - 1)) + [ "$ep_no" -lt "1" ] && err "Episode out of range" && ep_no=$((ep_no+1)) || get_ep_link;; + e) + input "$noofeps" + get_ep_link;; + q) + break;; + *) + err "invalid choice";; + esac +done diff --git a/rss b/rss index f704078..d15e04a 100755 --- a/rss +++ b/rss @@ -1,9 +1,19 @@ #!/bin/sh -tmp=$(notify-send -t 2000 "Parsing SubsPlease RSS... Please Wait..." -p) + +if [ "$(uname -o)" = "Android" ]; then + os="droid" + script_dir="$HOME" +else + os="linux" + script_dir="$HOME/repos_scripts" +fi + +. $script_dir/.functions +info_$os "Parsing SubsPlease RSS... Please Wait..." data=$(curl -s "https://subsplease.org/rss/?r=1080" | sed 's//\n/g') -name=$(printf "%s" "$data" | sed -nE 's_^.*Please\] (.*).*size>(.*) \1_p' | bemenu --fn 'Roboto 16' -i -c -W 0.6 -B 3 -l 25 -p "Search anime:") -[ -z "$name" ] && notify-send -u critical "Err.. Query empty" -r $tmp && exit 0 +name=$(printf "%s" "$data" | sed -nE 's_^.*Please\] (.*).*size>(.*) \1_p' | menu_$os "Search Anime: ") +[ -z "$name" ] && exit 0 id=$(printf "%s" "$name" | sed -nE 's/.*\[(.*)\].*/\1/p') magnet=$(printf "%s" "$data" | sed -nE "s_.*(.*$id.*).*_\1_p" | sed 's/amp;//g') -setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$magnet" +torrent_$os "$magnet" diff --git a/setwall b/setwall deleted file mode 100755 index 4a38b32..0000000 --- a/setwall +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -notify-send "Initiating wallpaper changing process" -r 2 -old="C01D41" -oldimg="/home/tanveer/wall/018.png" -img=$(nsxiv -t ~/wall/ -o) -[ -z "$img" ] && notify-send "Process aborted !!" -u critical -r 2 && exit 0 - -notify-send "Extracting Accent color.." -r 2 -accent=$(convert $img +dither -scale 25% -colors 10 -unique-colors txt: | tail -2 | head -1 | sed -nE 's/.* #([^ ]*).*/\1/p' | cut -c1-6) - -[ -z "$accent" ] && exit 0 -notify-send "Setting wallpaper.." -r 2 -xwallpaper --stretch "$img" & -notify-send "Tweaking system.." -r 2 -bspc config focused_border_color "#$accent" -notify-send "making changes permanent.." -r 2 -sed -i "s/$old/$accent/g" $HOME/.config/dunst/dunstrc -sed -i "s/$old/$accent/g" $HOME/.config/bspwm/bspwmrc -sed -i "s/$old/$accent/g" $HOME/.config/sxhkd/sxhkdrc -sed -i "s/$old/$accent/g" $HOME/repos_scripts/setwall -doas sed -i "s/$old/$accent/g" /usr/share/themes/Materia-dark-compact/gtk-3.0/gtk.css -doas sed -i "s/$old/$accent/g" /usr/share/themes/Materia-dark-compact/gtk-2.0/gtkrc -sed -i "s_${oldimg}_${img}_g" $HOME/.config/bspwm/bspwmrc -sed -i "s_${oldimg}_${img}_g" $HOME/repos_scripts/setwall -killall dunst -pkill -USR1 -x sxhkd -notify-send "generating terminal colorscheme.." -r 2 -$HOME/coolterm/run -t 'xres' "$img" -xrdb -merge -I$HOME ~/.Xresources -notify-send "Everything Done!!" -r 2 diff --git a/speedtest b/speedtest deleted file mode 100755 index e10fe5a..0000000 Binary files a/speedtest and /dev/null differ diff --git a/tor-bay b/tor-bay index e6eb3ab..0c152c2 100755 --- a/tor-bay +++ b/tor-bay @@ -11,15 +11,27 @@ display() { wait } -[ -z "$*" ] && query=$(printf "" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -p "Search torrent: ") || query=$* +case $(uname -o) in + *ndroid*) + os="droid" + script_dir="$HOME" + ;; + *) + os="linux" + script_dir="$HOME/repos_scripts" + ;; +esac + +. $script_dir/.functions +[ -z "$*" ] && search_$os "Search Torrent: " || query=$* [ -z "$query" ] && exit 0 -tmp=$(notify-send "Searching query" -p) +[ "$os" = "linux" ] && tmp=$(notify-send "Searching query" -p) query=$(printf "%s" "$query" | tr " " "+") -data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[|]") -notify-send "tidying up data" -r $tmp +data=$(curl -s "https://apibay.org/q.php?q=$query" | sed 's/},/}\n/g' | tr -d "[]") +[ "$os" = "linux" ] && notify-send "tidying up data" -r $tmp size=$(printf "%s" "$data" | sed -nE 's/.*name.*size":"(.*)",.*user.*/\1/p') name_seed=$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash.*seeders":"(.*)",.*num.*/\2] \1/p') -sel=$(display "$size" "$name_seed" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -l 25 -p "select torrent >" | cut -d" " -f3-) -[ -z "$sel" ] && notify-send -u critical "No Torrent Selected" -r $tmp && exit 0 || notify-send "Selected $sel" -r $tmp +sel=$(display "$size" "$name_seed" | menu_$os "Select Torrent: " | cut -d" " -f3-) +[ -z "$sel" ] && exit 0 magnet="magnet:?xt=urn:btih:$(printf "%s" "$data" | sed -nE 's/.*name":"(.*)","info_hash":"(.*)",.*leech.*/\2\t\1/p' | sed -n "s/\t$sel//p")" -setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$magnet" +torrent_$os "$magnet" diff --git a/tor-cli b/tor-cli index 881d685..973ec72 100755 --- a/tor-cli +++ b/tor-cli @@ -1,7 +1,19 @@ #!/bin/sh -[ -z "$*" ] && query=$(printf "" | bemenu --fn 'Roboto 15' -i -c -W 0.6 -B 3 -p "Search torrent: ") || query=$* +case $(uname -o) in + *ndroid*) + os="droid" + script_dir="$HOME" + ;; + *) + os="linux" + script_dir="$HOME/repos_scripts" + ;; +esac + +. $script_dir/.functions +[ -z "$*" ] && search_$os "Search Torrent: " || query=$* [ -z "$query" ] && exit 0 query=$(printf "%s" "$query" | tr ' ' '+') magnet=$(curl -s "https://thepiratebay0.org/s/?page=0&orderby=0&q=$query" | tr '\n' ' ' | sed -e 's__\n_g;s_ \;__g' | sed -nE 's_.*title.*">([^<]*).*a href="(magnet[^"]*)".*Size ([^,]*).*">([^<]*)<.*<.*_\[size:\3,se:\4\]\t\1\t\2_p' | fzf -d'\t' --with-nth ..2 | cut -f3) -[ -z "$magnet" ] || setsid -f $TERMINAL -e $HOME/repos_scripts/torrent "$magnet" +[ -z "$magnet" ] || torrent_$os "$magnet" diff --git a/torrent b/torrent index 27d5a42..6519d8c 100755 --- a/torrent +++ b/torrent @@ -8,10 +8,19 @@ c_reset="\033[0m" down(){ tput reset - notify-send "Torrent: Downloading" - aria2c -d Downloads --select-file=$2 --seed-time=0 $1 && notify-send "Torrent: Download complete" && rm -f $file || notify-send -u critical "Torrent: Error!!" + info_$os "Torrent: Downloading" + aria2c -d Downloads --select-file=$2 --seed-time=0 $1 && info_$os "Torrent: Download complete" && rm -f $file || error_$os "Torrent: Error!!" } +if [ "$(uname -o)" = "Android" ]; then + os="droid" + script_dir="$HOME" +else + os="linux" + script_dir="$HOME/repos_scripts" +fi + +. $script_dir/.functions trap "rm -f $HOME/.cache/*.torrent;exit 0" INT HUP [ -z "$*" ] && magnet="$(wl-paste)" || magnet="$*" echo "$magnet" diff --git a/uefi b/uefi deleted file mode 100755 index 6570b96..0000000 --- a/uefi +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -#extracting info from drives -data=$(mount -l | sed -nE 's|([^ ]*) on \/boot.*|\1|p') - -#extracting drive name -drive=$(printf '%s' "$data" | sed -nE 's|(.*nvme.*)p[0-9]*$|\1|p;s|(.*[s|v]d[a-z])[0-9]*$|\1|p') - -#extracting efi partition -efi_part_no=$(printf '%s' "$data" | sed -nE 's/.*([0-9])$/\1/p') - -#extracting root partition -root_part=$(sed -nE 's|^([^#][^ ]*).*/ .*|\1|p' /etc/fstab | tr -d '\t') - -#extracting ur OS name from os-release -os_name=$(sed -nE 's/^NAME="([^"]*)"/\1/p' /etc/os-release) - -#checking for swap(this is currently not called in final command as not most people use hibernate..) -lsblk | grep -q 'SWAP' && swap="resume=$(blkid | sed -nE 's/.*(UUID[^ ]*).*swap.*/\1/p' | sed 's/"//g') " - -#checking for ucode in ur /boot -ls /boot/ | grep -q 'ucode' && ucode=" initrd=\\$(find /boot/ | sed -nE 's|.*/(.*code.*)|\1|p')" - -#fetching kernels list in /boot -kernel=$(ls /boot/ | sed -nE 's|(vmlinuz-.*)|\1|p') - -#iterating kernel -for i in $kernel;do - kernel_ver=$(printf '%s' "$i" | sed -nE 's/vmlinuz-(.*)/\1/p') - grep -q 'Arch Linux' /etc/os-release && initrd=$(ls /boot/ | sed -nE "s|(init.*$kernel_ver\.img)|\1|p") || initrd=$(ls /boot/ | sed -nE "s|(init.*$kernel_ver.*)|\1|p") - [ -z "$initrd" ] && continue - printf "\n\033[1;35mKernel : \033[1;32m%s\n" "$(printf "%s" "$i" | sed -nE 's/vmlinuz-(.*)/\1/p')" - command="efibootmgr --create --disk $drive --part $efi_part_no --label '${os_name}' --loader /$i --unicode 'root=$root_part rw initrd=\\${initrd}${ucode}'" - - printf "\033[1;36m%s\n" "$command" -done diff --git a/youtube b/youtube index dc748f8..71632ce 100755 --- a/youtube +++ b/youtube @@ -1,7 +1,7 @@ + + #!/bin/sh - -# script for downloading videos/audios and/or extract part from it.. - +# script for downloading videos/audios from sites... # defining shell colors for distinction c_red="\033[1;31m" c_green="\033[1;32m" @@ -11,40 +11,25 @@ c_magenta="\033[1;35m" c_cyan="\033[1;36m" c_reset="\033[0m" -#function to download full video/audio -full(){ - [ -z "$2" ] && - yt-dlp -o "$HOME/Videos/%(title)s.%(ext)s" "$1" || - yt-dlp -f 'ba' -x --audio-format mp3 "$1" -o "$HOME/Music/%(title)s.%(ext)s" -} - -# function to download part of a video/audio.. part(){ - video=$1 - printf "${c_magenta}Enter Start Point(hh:mm:ss)or(mm:ss)${c_reset}:" + printf "${c_magenta}Enter Starting Point(hh:mm:ss)or(mm:ss)${c_reset}:" read start - 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/$(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" + printf "${c_yellow}Enter Upto Seconds:${c_cyan}" + read dur + ffmpeg -loglevel error -stats -i $(yt-dlp -f "$3" --get-url "$1") -ss $start -t $dur /sdcard/$(date +%s).$2 } #program starts from here.. -x=$(wl-paste) -printf "${c_blue}Youtube link :${c_magenta}$x\n" -printf "${c_yellow}Download>>\n${c_blue}[a]udio only\n${c_magenta}[f]part of Audio only\n${c_green}[v]ideo\n${c_cyan}[p]art of video\n${c_red}[q]uit" +x=$(termux-clipboard-get) +[ "$1" = "v" ] && yt-dlp "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "video downloaded" && exit 0 +printf "\n${c_blue} video link :${c_magenta}$x\n" +printf "${c_yellow}Download>>\n${c_blue}[a]Audio only\n${c_magenta}[f]part of Audio only\n${c_green}[v]Full video\n${c_cyan}[p]Part of video\n${c_red}[q]Quit" printf "\n${c_reset}Enter choice:${c_green}" read choice case $choice in - a) - full "$x" "1" && notify-send "Audio saved to Music Directory" || notify-send -u critical "Error!!! Audio not Downloaded";; - f) - part "$x" "1" && notify-send "Audio saved to Music Directory" || notify-send -u critical "Error!!! Audio not Downloaded";; - v) - full "$x" && notify-send "Video saved to Videos Directory" || notify-send -u critical "Error!!! Video not Downloaded";; - p) - part "$x" && notify-send "Video saved to Videos Directory" || notify-send -u critical "Error!!! Video not Downloaded";; - q) - break;; + a) yt-dlp -f 'ba' -x --audio-format mp3 "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "audio downloaded";; + f) part "$x" "mp3" "ba" && termux-notification -c "audio downloaded";; + v) yt-dlp "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "video downloaded";; + p) part "$x" "mp4" "b" && termux-notification -c "video downloaded";; + q) exit 0;; esac diff --git a/yt-music b/yt-music index f4bb987..8cd53d5 100755 --- a/yt-music +++ b/yt-music @@ -88,12 +88,12 @@ play(){ #get song's audio url random_no=$(head /dev/urandom | tr -dc '0-2' | cut -c1) - droid_agent="com.google.android.youtube/17.49.34 (Linux; U; Android 1$random_no) gzip" + droid_agent="com.google.android.youtube/18.07.34 (Linux; U; Android 1$random_no) gzip" json="{ \"context\": { \"client\": { \"clientName\": \"ANDROID\", - \"clientVersion\": \"17.49.34\", + \"clientVersion\": \"18.07.34\", \"androidSdkVersion\": $((random_no + 29)), \"userAgent\": \"$droid_agent\", \"hl\": \"en\", @@ -112,7 +112,7 @@ play(){ \"racyCheckOk\": true }" - audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:21" -H "x-youtube-client-version:17.46.37" -d "$json" -b "$cookie" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p') + audio_url=$(curl -X POST -A "$droid_agent" -s "https://www.youtube.com/youtubei/v1/player?key=AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w&prettyPrint=false" -H "content-type:application/json" -H "x-youtube-client-name:21" -H "x-youtube-client-version:18.07.34" -d "$json" -b "$cookie" | sed -nE 's_.*itag":251,"url":"([^"]*)".*_\1_p') if [ -n "$2" ];then printf "Name >> %s\n" "$title" printf "videoID >> %s\n" "$id"