Skip to content

Instantly share code, notes, and snippets.

@phnahes
Created June 10, 2025 19:03
Show Gist options
  • Save phnahes/6696ec1194768293908ecc387a1b5e04 to your computer and use it in GitHub Desktop.
Save phnahes/6696ec1194768293908ecc387a1b5e04 to your computer and use it in GitHub Desktop.
Download Youtube Playlist mp3 files
#!/bin/bash
# URL da playlist
PLAYLIST_URL="https://www.youtube.com/watch?v=&list=RDQMryGw58F5QcU"
# Diretório de destino para os arquivos
DEST_DIR="musicas"
mkdir -p "$DEST_DIR"
# Baixar a lista de URLs e nomes das faixas
yt-dlp --flat-playlist -J "$PLAYLIST_URL" | jq -r '.entries[] | .url' > urls.txt
# Processar cada faixa com delay
while read -r URL; do
echo "Baixando: $URL"
yt-dlp -x --audio-format mp3 --audio-quality 0 -o "$DEST_DIR/%(playlist_index)s - %(title)s.%(ext)s" "$URL"
# Delay de 5 segundos entre as faixas
echo "Aguardando 5 segundos antes da próxima faixa..."
sleep 5
done < urls.txt
# Limpeza do arquivo temporário
rm urls.txt
echo "Download completo!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment