diff options
-rwxr-xr-x | yt-dlp-best | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/yt-dlp-best b/yt-dlp-best new file mode 100755 index 0000000..9b239f0 --- /dev/null +++ b/yt-dlp-best @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +USAGE="Fetches the best format of a YT video (ideally in mp4) +yt-dlp-best \"URL\" +" + +if [ $# -ne 1 ]; then + echo $USAGE + exit 1 +fi + +URL=$1 + +FMT_LINE=$(yt-dlp -F "${URL}" | tail -n 2 | grep "mp4") + +FMT=$(echo ${FMT_LINE} | cut -d" " -f1) + +echo "${FMT_LINE}" +echo "yt-dlp -f ${FMT}+m4a \"${URL}\"" +read -p "proceed (Y/N): " answer + +if [[ "$answer" =~ ^[yY][eE]{0,1}[sS]{0,1}$ ]]; then + yt-dlp -f ${FMT}+m4a "${URL}" + exit 0 +else + echo "Okay, cancelling" + exit 1 +fi + + |