From 20604fdc7d20628e12c633ad340fd88ba8ca1591 Mon Sep 17 00:00:00 2001 From: mattmcw Date: Sun, 9 May 2021 11:07:26 -0400 Subject: [PATCH] Add a youtube-dl example --- stream/audio.sh | 2 +- stream/download.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 stream/download.sh diff --git a/stream/audio.sh b/stream/audio.sh index 3cbb246..85ab883 100644 --- a/stream/audio.sh +++ b/stream/audio.sh @@ -5,7 +5,7 @@ # This script will download a video and extract the # audio as an .mp3. # -# Usage: bash stream/rtmp.sh +# Usage: bash stream/audio.sh # ##################################################### diff --git a/stream/download.sh b/stream/download.sh new file mode 100644 index 0000000..47e2d08 --- /dev/null +++ b/stream/download.sh @@ -0,0 +1,28 @@ +#!/bin/bash -e + +##################################################### +# +# This script will download a video at its highest +# quality available. +# +# Usage: bash stream/download.sh +# +##################################################### + +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}" \ No newline at end of file