uknowngithubuser
10/20/2018 - 6:15 PM

Youtube-Music #ubuntu #shell #utillities

Youtube-Music #ubuntu #shell #utillities

#!/bin/bash

cd ~/Music || return

# get output format
# pass these as values - vorbis,mp3,m4a,wav
format=vorbis
if [ "$2" ]; then
	format=$2
fi

# download

if hash aria2c 2> /dev/null; then
  youtube-dl --prefer-ffmpeg -f 171/251/140/bestaudio --extract-audio --audio-format "$format" --audio-quality 0 --external-downloader aria2c "$1"
else
  youtube-dl --prefer-ffmpeg -f 171/251/140/bestaudio --extract-audio --audio-format "$format" --audio-quality 0 "$1"
fi

# 171 - webm 145k, 251 - webm 167k, 140 - m4a 129k