Last active 1741880385

Revision 00cdf67fb8b9eaaecc6e159fa9cd59e9b69ea160

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 OUTPUT="$DIR/%(id)s.%(ext)s"
10else
11 echo Downloading $1 as $2
12 OUTPUT="$DIR/$2.%(ext)s"
13fi
14youtube-dl -f 'bestaudio[ext=m4a]' "$1" --output $OUTPUT --add-metadata --embed-thumbnail --no-playlist
15