Skip to content

Instantly share code, notes, and snippets.

@gsmitheidw
Last active September 23, 2016 12:38
Show Gist options
  • Save gsmitheidw/eba9ee3606e8ffb750ca06bb4af61e17 to your computer and use it in GitHub Desktop.
Save gsmitheidw/eba9ee3606e8ffb750ca06bb4af61e17 to your computer and use it in GitHub Desktop.
# Grab mp3 creates mp3s from youtube-dl in a format that works in more devices which may have issues with VBR etc
#
# Requires: chocolately from chocolately.org then run this commented out line in an escalated powershell prompt:
# cinst youtube-dl ffmpeg lame -y --allowEmptyChecksums # some of these don't currently have checksums enabled by their maintainers
# Probably best to put this script somewhere in your system path
# Set up graphical input/output
Add-Type -AssemblyName Microsoft.VisualBasic
$link = "" #null
$link = [Microsoft.VisualBasic.Interaction]::InputBox('Paste in youtube URL or playlist url', 'grab-mp3')
# optional non-graphical input, could use passed in arguments but then have to worry about delimiting certain characters etc
#$link = Read-Host -Prompt 'Paste in youtube url or playlist url'
# Process input through youtube-dl then lame
youtube-dl --prefer-ffmpeg --extract-audio --audio-format wav -o "%(title)s.%(ext)s" --restrict-filenames --exec 'lame --add-id3v2 --tt {} -b 192 -q 0 {} && del {}' $link # not using Remove-Item by design
[Microsoft.VisualBasic.Interaction]::MsgBox("Music Processed!", "OKOnly,SystemModal,Information", "grab-mp3")
# write-host "Completed\n" # but with no error checking whatsover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment