m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/yt-dl-choose
diff options
context:
space:
mode:
Diffstat (limited to 'yt-dl-choose')
-rwxr-xr-xyt-dl-choose17
1 files changed, 8 insertions, 9 deletions
diff --git a/yt-dl-choose b/yt-dl-choose
index 7d33588..63a78a7 100755
--- a/yt-dl-choose
+++ b/yt-dl-choose
@@ -22,15 +22,14 @@ if [[ $NO_PLAYLIST ]]; then
URL=`echo "$URL" | sed -e 's/&list=.*&/\&/'`
fi
-formats=`yt-dlp --list-formats $URL \
- | grep -v "audio only" \
- | grep -v "video only" \
- | grep -v mhtml \
- | sed '0,/---------/d' `
-format=`echo "$formats" | dmenu | cut -d' ' -f1`
-
-if [ -z "$format" ]; then
+video_formats=`yt-dlp --list-formats $URL \
+ | grep "video only" \
+ | grep -v mhtml`
+echo "video formats are:\n$video_formats"
+video_format=`echo "$video_formats" | dmenu | cut -d' ' -f1`
+
+if [ -z "$video_format" ]; then
exit 0;
fi
-mpv --ytdl-format=$format $1
+mpv --ytdl-format="$video_format+bestaudio" $URL