Last active 1741880385

Revision 709237327ee9674b2fcd5ed6d01f8c8afbb753f1

download_youtube.sh Raw
1#!/bin/bash
2DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
3if [[ "$#" -lt 1 ]]; then #if less than 1
4 echo "Usage: ./download.sh <youtube url> [name of file] "
5 exit 2
6fi
7if [[ "$#" -ne 2 ]]; then
8 echo Downloading $1
9 youtube-dl -f 'bestaudio[ext=m4a]' "$1" --output "$DIR/%(id)s.%(ext)s"
10else
11 echo Downloading $1 as $2
12 youtube-dl -f 'bestaudio[ext=m4a]' "$1" --output "$DIR/$2.%(ext)s"
13fi
14