mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
43 lines
842 B
Bash
Executable File
43 lines
842 B
Bash
Executable File
#!/bin/sh
|
|
# script for downloading videos/audios from sites...
|
|
#shellcheck disable=SC2317
|
|
|
|
info() {
|
|
printf "\033[1;36m[ %s ] [ %s ] %s\033[0m\n" "$2" "$3" "$1"
|
|
}
|
|
|
|
error() {
|
|
printf "\033[1;31m[ %s ] [ %s ] %s\033[0m\n" "$2" "$3" "$1"
|
|
}
|
|
|
|
notify_droid() {
|
|
termux-notification -c "$1"
|
|
}
|
|
|
|
notify_linux() {
|
|
notify-send -e "$1" -h "string:x-canonical-private-synchronous:${0##*/}"
|
|
}
|
|
|
|
#main
|
|
link="$1"
|
|
|
|
case $(uname -o) in
|
|
*ndroid*)
|
|
download_dir="$HOME/storage/downloads"
|
|
[ -z "$link" ] && link=$(termux-clipboard-get)
|
|
os="droid"
|
|
;;
|
|
*)
|
|
download_dir="$HOME"
|
|
[ -z "$link" ] && link=$(wl-paste)
|
|
os="linux"
|
|
;;
|
|
esac
|
|
|
|
printf "\033[1;34m Video link :\033[0m %s\n" "$link"
|
|
|
|
yt-dlp --no-skip-unavailable-fragments --fragment-retries infinite -N 16 -t mp4 "$link" -o "$download_dir/%(title)s.%(ext)s"
|
|
|
|
notify_$os "Video Downloaded"
|
|
exit 0
|