Does youtube API provide the original audio you are listening from youtube as a download option? Is it perhaps the --extract-audio option?
As mentioned, the defaults are set to download the highest quality from the provided video URL. This isn't the same as saying that it always will be so, and it certainly hasn't always been so.
I'm a fan of stability, and have better experience with specifying the options directly, as defaults have a tendency to change with versions / updates, but using the specific options would still be valid, or you'd get a warning or error.
Using the direct options I know what I end up with.
It's also more flexible.
You can choose what preferred formats to prioritize, and get the best compatible video + audio merged automatically if the requested format/quality is unavailable and you can specify a format string for naming the downloaded file, and decide where it will end up (by default it's the current working directory).
You can use a separate settings file, on the Mac its by default:
~/.config/youtube-dl/config
Or, you can use an alias defined in your shell
(I've named the alias :ytdl
) so I just do:
:ytdl link_to_single_video
And have it set to automatically download the preferred video/audio format and merge them together at a location specified in the alias command in my shell startup file, using the naming convention I've decided it to use.
I also have a :ytdlpl playlist_id
alias that downloads complete playlists to a specified folder:
/playlists/[name_from_playlist_title]/[episode_num_and_name_from_playlist].[ext]
I've done this by setting up the two aliases:
# Download best mp4 format available or other format if no mp4 is available
alias :ytdl='/usr/local/bin/youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" -o "/Volumes/SSD/Video/YTDL/%(title)s.%(ext).s"'
# Download YouTube playlist videos in separate directory indexed by video order in a playlist
alias :ytdlpl='/usr/local/bin/youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" -o "/Volumes/SSD/Video/YTDL/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"'
How you choose to do this is personal preference, but this works perfectly for my needs at least! 👍