gentoo-dots/.config/qutebrowser/userscripts/yt-dlp

24 lines
795 B
Bash
Executable File

#!/bin/sh
audio() {
printf "message-info 'Downloding audio for %s'" "$QUTE_URL" >>"$QUTE_FIFO"
yt-dlp -x -f bestaudio --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --audio-format vorbis -o "%(title)s.%(ext)s" "$QUTE_URL"
notify-send "QuteBrowser yt-dlp" "Finished downloading audio"
}
audio_video() {
printf "message-info 'Downloding audio+video for %s'" "$QUTE_URL" >>"$QUTE_FIFO"
yt-dlp --merge-output-format mp4 -f "bestvideo+bestaudio[ext=m4a]/best" --embed-thumbnail --external-downloader aria2c --external-downloader-args "-j 16 -s 16 -x 16 -k 5M" --add-metadata -o "%(title)s.%(ext)s" "$QUTE_URL"
notify-send "QuteBrowser yt-dlp" "Finished downloading audio+video"
}
case "$1" in
"audio")
audio
exit
;;
"audio+video")
audio_video
;;
esac