Install or download yt-dlp

Open terminal.

MP3 (Audio)

1
yt-dlp --verbose --extract-audio --audio-format mp3 --audio-quality 0 https://www.youtube.com/watch\?v\=9NbeL4FtcN0

Audio quality is number from 0 (best) to 10 (worst).

MP4 (Video)

1
yt-dlp --verbose -S "res:720" -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" https://www.youtube.com/watch\?v\=9NbeL4FtcN0

Works for Facebook videos too with URL like: https://www.facebook.com/watch/?v=280191971840839