unix4artists/stream/download.sh

28 lines
534 B
Bash

#!/bin/bash -e
#####################################################
#
# This script will download a video at its highest
# quality available.
#
# Usage: bash stream/download.sh <url> <output dir>
#
#####################################################
URL="${1}"
if [ "${1}" == "" ]; then
echo "Please provide a URL to download"
exit 1
fi
if [ -d "${2}" ]; then
DIR="${2}"
else
echo "Please provide an output directory for your video file"
exit 2
fi
youtube-dl -f best \
-o "${DIR}/%(title)s-%(id)s.%(ext)s" \
"${URL}"