#!/bin/bash

# Ask for the folder name
read -p "Enter the name for the new folder: " foldername

# Create the folder (and any parent folders if needed)
mkdir -p "$foldername"

# Ask for the URL
read -p "Enter the YouTube Playlist/Video URL: " url

# Move into the folder
cd "$foldername" || exit

echo "------------------------------------------"
echo "Downloading to: $(pwd)"
echo "------------------------------------------"

# Run the command
yt-dlp -x --audio-format mp3 --audio-quality 0 \
    --embed-thumbnail --add-metadata \
    -o "%(title)s.%(ext)s" \
    --yes-playlist "$url"

echo "------------------------------------------"
echo "Done! Your files are in '$foldername'."
