Last active
October 2, 2025 22:38
-
-
Save eduardopintor/03e2e1f1b0052f8ac81c358874ab4126 to your computer and use it in GitHub Desktop.
Youtube playlist mp3 download - Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # variável para o diretório de saída | |
| PARENTDIR="/your/parent/dir" | |
| OUTDIR="$PARENTDIR/%(channel)s/%(playlist)s/%(title)s.%(ext)s" | |
| # lê a URL | |
| read -rp "Enter URL: " url | |
| # pergunta se quer baixar a playlist inteira | |
| read -rp "Download whole playlist? (y/N) " yn | |
| yn=${yn:-N} | |
| if [[ $yn =~ ^[Yy]$ ]]; then | |
| # baixa áudio e thumbnail da playlist inteira | |
| yt-dlp -x --audio-format mp3 \ | |
| -o "$OUTDIR" \ | |
| --rm-cache-dir \ | |
| --yes-playlist \ | |
| --embed-thumbnail \ | |
| "$url" | |
| else | |
| # pede intervalo de início/fim da playlist (opcional) | |
| read -rp "Start at (leave empty to start at 1): " startnumber | |
| read -rp "End at (leave empty for no end): " endnumber | |
| opts=() | |
| [[ -n $startnumber ]] && opts+=(--playlist-start "$startnumber") | |
| [[ -n $endnumber ]] && opts+=(--playlist-end "$endnumber") | |
| yt-dlp -x --audio-format mp3 \ | |
| -o "$OUTDIR" \ | |
| --rm-cache-dir \ | |
| "${opts[@]}" \ | |
| --embed-thumbnail \ | |
| "$url" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment