Skip to content

Instantly share code, notes, and snippets.

@jrgcubano
Forked from Nezteb/Download_Songs.sh
Created March 16, 2016 10:52
Show Gist options
  • Save jrgcubano/a6df7e8b5ece515bb2d6 to your computer and use it in GitHub Desktop.
Save jrgcubano/a6df7e8b5ece515bb2d6 to your computer and use it in GitHub Desktop.
Downloads specified youtube videos as songs given text file.
#!/bin/bash
[ "$#" -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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment