need another beer

This commit is contained in:
coolnsx
2023-08-10 12:30:42 +05:30
parent 9287e03f41
commit 33fad01b66
10 changed files with 116 additions and 23 deletions

21
youtube
View File

@@ -14,20 +14,31 @@ part() {
read start
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
ffmpeg -loglevel error -stats -i "$(yt-dlp -f "$3" --get-url "$1")" -ss "$start" -t "$dur" "$download_dir/$(date +%s).$2"
}
case $(uname -o) in
*ndroid*)
download_dir="/sdcard"
x=$(termux-clipboard-get)
;;
*)
download_dir="$HOME"
x=$(wl-paste)
;;
esac
#program starts from here..
x=$(termux-clipboard-get)
[ "$1" = "v" ] && yt-dlp "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "video downloaded" && exit 0
[ -n "$1" ] && x=$1
[ "$1" = "v" ] && yt-dlp "$x" -o "$download_dir/%(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) yt-dlp -f 'ba' -x --audio-format mp3 "$x" -o "/sdcard/%(title)s.%(ext)s" && termux-notification -c "audio downloaded" ;;
a) yt-dlp -f 'ba' -x --audio-format mp3 "$x" -o "$download_dir/%(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" ;;
v) yt-dlp "$x" -o "$download_dir/%(title)s.%(ext)s" && termux-notification -c "video downloaded" ;;
p) part "$x" "mp4" "b" && termux-notification -c "video downloaded" ;;
q) exit 0 ;;
esac