Last active
December 20, 2015 20:59
-
-
Save mislav/6194381 to your computer and use it in GitHub Desktop.
Download a song from YouTube/SoundCloud and import the audio to iTunes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: steal <YOUTUBE-URL> | |
# Requirements: youtube-dl, ffmpeg | |
set -e | |
# strip the YouTube playlist | |
url="${1%%&*}" | |
if [ -z "$url" ]; then | |
echo "no URL given" >&2 | |
exit 1 | |
fi | |
youtube-dl --no-mtime -xo '/tmp/%(title)s.%(ext)s' "$url" | |
shopt -s nullglob | |
mv "$(ls -t /tmp/*.{m4a,mp3,mp4} | head -1)" \ | |
"$HOME/Music/iTunes/iTunes Media/Automatically Add to iTunes/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment