#!/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" full_video() { video=$1 youtube-dl -f best "$video" } part_video() { video=$1 printf "${c_magenta}Enter Starting Point(hh:mm:ss)or(mm:ss)${c_reset}:" read start printf "${c_yellow}Enter Upto Seconds:${c_cyan}" read dur ffmpeg -i $(youtube-dl -f best --get-url "$video") -ss $start -t $dur $HOME/Videos/$(date +%s).mp4 } printf "${c_blue}Input Youtube link :${c_magenta}" read x printf "${c_yellow}Download>>\n${c_green}[f]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 f) full_video "$x";; p) part_video "$x";; q) break;; esac