2 ms·
Cool, here's my simple script to select format called vdl, and can be extended: #!/bin/bash OPTS="-o %(title)s.%(ext)s --console-title --restrict-filen
by mixmastamyk 7y ago
Cool, here's my simple script to select format called vdl, and can be extended:
#!/bin/bash
OPTS="-o %(title)s.%(ext)s --console-title --restrict-filenames"
if [ "$#" -eq 2 ]; then
if [ "$2" -eq "251" ]; then
OPTS="$OPTS -x"
fi
echo youtube-dl $OPTS -f $2 $1
youtube-dl $OPTS -f $2 $1
else
echo youtube-dl -F $*
youtube-dl -F $*
echo
echo -n "Enter number: "
read fmt
youtube-dl $OPTS -f $fmt $*
fi
To explain, if you know the format number off the top of your head you can pass it after the video id, otherwise it will prompt. Might upgrade it one day to use "set -x" instead of echo and exec.
- JetSpiegel 7y ago- Quote "$2" and "$1" - Use "$@" instead of $* - Use: OPTS=(-o "%(title)s.%(ext)s" --console-title --restrict-filenames) "${OPTS[@]}" This is what shellcheck reports.
- mixmastamyk 7y agoCool, love those kind of tools. However, the youtube (and other sites id) and the format number will never contain spaces, so quoting isn't really needed here. If it gives peace of mind, sure.