Skip to content

Instantly share code, notes, and snippets.

@xavhan
Last active January 10, 2016 14:56
Show Gist options
  • Save xavhan/7f277eeeeb95e493e2ee to your computer and use it in GitHub Desktop.
Save xavhan/7f277eeeeb95e493e2ee to your computer and use it in GitHub Desktop.
Alias for downloading youtube music and automatically tag it
# Nice alias for youtube-dl for downloading mp3 from youtube
# and other media services, parse the title and the thumbnail
# to add the adequate metadatas.
# You need to provide a youtube id.
# > ytmp3 venrUQLZ87M
# or
# > ytmp3 https://www.youtube.com/watch?v=venrUQLZ87M
# It works with playlists too !
#
# You can also provide it by a list of ids in a file. Yay!
# > ytmp3 -a mylistoffiles.txt
# first you need to install youtube-dl (https://github.com/rg3/youtube-dl/)
# > brew install youtube-dl
# and ffmpeg
# > brew install ffmepeg
# and add this alias to your .zshrc or .bash_profile
# I harcoded the output directory to ~/Downloads/ but you can revove it if you
# prefer to download to the current working path.
alias ytmp3="youtube-dl \
--ignore-errors \
--extract-audio \
--audio-format 'mp3' \
--audio-quality 320K \
--output '~/Downloads/Perso/Musique/%(title)s.%(ext)s' \
--add-metadata \
--embed-thumbnail \
--prefer-ffmpeg \
--metadata-from-title '%(artist)s - %(title)s' \
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment