dotfiles/scripts/playlist-dl

15 lines
387 B
Bash
Executable File

#!/usr/bin/env bash
set -x
echo "Looking up playlist name..."
pl_line=$(yt-dlp --flat-playlist "$1" | grep "\[download\] Downloading playlist: ")
pl_name=$(echo ${pl_line:33} | tr '/' ' ')
echo "Found playlist by name: $pl_name"
echo "Downloading it into directory: $pl_name"
mkdir "$pl_name"
cd "$pl_name"
yt-dlp --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1"
cd ../