#!/bin/bash # Download_Songs.sh # By Noah Betzen (Nezteb) # # Requires youtube-dl: https://rg3.github.io/youtube-dl/ # You can install youtube-dl via most package managers: # brew install youtube-dl # apt-get install youtube-dl # # Creates relative directory called "downloads" with downloaded songs in it # # Sample file: (two video URLs on own lines, songs.txt) # https://www.youtube.com/watch?v=abcdefghijk # https://www.youtube.com/watch?v=lmnopqrstuv # # Once downloaded, song URL is removed from file [ "$#" -eq 1 ] || { echo >&2 "Requires single text file (with youtube links on each line) name as argument."; exit 1; } command -v youtube-dl >/dev/null 2>&1 || { echo >&2 "Install youtube-dl first."; exit 1; } if [ ! -d "downloads" ]; then mkdir downloads fi while IFS='' read -r line || [[ -n "$line" ]]; do youtube-dl -x --audio-format mp3 $line -o './downloads/%(title)s.%(ext)s' grep -v "$line" $1 > temp mv temp $1 done < "$1"