Skip to content

Instantly share code, notes, and snippets.

@nmarley
Created January 22, 2025 17:52
Show Gist options
  • Save nmarley/eb7f68217173f398d95725e95ca88425 to your computer and use it in GitHub Desktop.
Save nmarley/eb7f68217173f398d95725e95ca88425 to your computer and use it in GitHub Desktop.
Download best quality audio from YouTube video
#! /bin/bash
# yt-dlp command to download the best audio quality from a youtube video
# yt-dlp --format bestaudio --extract-audio --audio-format opus --audio-quality 0 https://www.youtube.com/watch?v=jhoG3WcECnw
if [ -z "$1" ]; then
echo "Usage: $0 <youtube-url>"
exit 1
fi
# Add the `--` at the end in case the video ID starts with a dash (YouTube does
# this sometimes)
yt-dlp --format bestaudio --extract-audio --audio-format opus --audio-quality 0 -- "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment