Last active 1741880385

Revision 9f7c86ae5d09f52c6ce1e3fb462374755216ebbe

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