MacOS – Automator application that asks me for a YouTube URL before running the command

automatorcommand linemacos

I'm trying to make an Automator application that runs this command:

youtube-dl -x --audio-format wav -o "~/Downloads/%(title)s.%(ext)s" 'youtube file url'

but I’d like for it to ask me for the YouTube URL before running. Have been unsuccessful so far, would appreciate any help.

enter image description here

Best Answer

Through lots of trial and error I finally managed to actually download and extract the audio. However I'm getting an error message: "ffprobe/avprobe and ffmpeg/avconv not found. Please install one." Thing is my ffmpeg is fully up to date. I even reinstalled it just in case. My "youtube-dl" is also up to date.

Addressing your comment...

The default PATH passed to a Run Shell Script action in Automator is:

/usr/bin:/bin:/usr/sbin:/sbin

Add a PATH statement at the top of the code in the Run Shell Script action,

To determine what the normal PATH is, in Terminal run echo $PATH and then for the Run Shell Script action use whatever it outputs, e.g.

PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

for f in "$@"; do
    /usr/local/bin/youtube-dl -x --audio-format wav -o "$HOME/Downloads/%(title)s.%(ext)s"  "$f"
done