Skip to content

Instantly share code, notes, and snippets.

@faun
Forked from mislav/steal.sh
Last active August 29, 2015 13:57
Show Gist options
  • Save faun/9501666 to your computer and use it in GitHub Desktop.
Save faun/9501666 to your computer and use it in GitHub Desktop.
Download videos from youtube and add them to iTunes
#!/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 -f mp4/webm --no-mtime -o '/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