Skip to content

Instantly share code, notes, and snippets.

@katsaii
Last active August 14, 2019 14:22
Show Gist options
  • Save katsaii/08825b411de67e1bcb86d4b65049cc85 to your computer and use it in GitHub Desktop.
Save katsaii/08825b411de67e1bcb86d4b65049cc85 to your computer and use it in GitHub Desktop.
A wrapper to shorten the youtube-dl command 'youtube-dl --extract-audio --audio-format (fmt) (url)' to simply 'download (fmt) (url)'.
@echo off
set fmt=%1
set url=%*
:: Strip fmt from url
set s=%fmt%
:loop
if [%s%] NEQ [] (
set s=%s:~1%
set url=%url:~1%
goto loop
)
:: Strip whitespace delimiter
set url=%url:~1%
:: Download
echo Downloading: %url%
echo Audio Format: %fmt%
youtube-dl --extract-audio --audio-format %fmt% %url%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment