@echo off
title YT-DLP Simple Downloader, by Adula
setlocal enabledelayedexpansion

:menu
cls
echo Select an option:
echo 1. Download a video
echo 2. Download a playlist
echo 3. Update yt-dlp
echo 4. Exit
set /p option=Enter option number: 

if "%option%"=="1" goto video
if "%option%"=="2" goto playlist
if "%option%"=="3" goto update
if "%option%"=="4" exit

echo Invalid option. Try again.
pause
goto menu

:video
cls
set /p url_video=Paste video URL: 
set /p audio=Audio only? (Y/N): 

if /I "%audio%"=="Y" (
    yt-dlp.exe -f "bestaudio" --extract-audio --audio-format mp3 -o "%%(title)s.mp3" "%url_video%"
) else (
    yt-dlp.exe -o "%%(title)s.%%(ext)s" "%url_video%"
)

echo Download complete!
pause
goto menu

:playlist
cls
set /p url_playlist=Paste playlist URL: 
set /p audio=Audio only? (Y/N): 

if /I "%audio%"=="Y" (
    yt-dlp.exe -f "bestaudio" --extract-audio --audio-format mp3 -o "%%(playlist_title)s/%%(title)s.mp3" --yes-playlist "%url_playlist%"
) else (
    yt-dlp.exe -o "%%(playlist_title)s/%%(title)s.%%(ext)s" --yes-playlist "%url_playlist%"
)

echo Download complete!
pause
goto menu

:update
cls
echo Updating yt-dlp...
yt-dlp.exe --update
echo Update complete!
pause
goto menu
