2 $Path = Join-Path -Path $HOME -ChildPath "\Documents\YouTube"
3 $exe = Join-Path -Path $Path -ChildPath "\yt-dlp.exe"
7 # Switch to directory with executable
10 # Remove old executable
11 Remove-Item yt-dlp.exe
13 # Download new executable
14 Invoke-WebRequest https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -OutFile $exe
18 # Ask the user if they are downloading audio or video
19 $Type = Read-Host "Audio or Video?"
22 if($Type -eq "audio") {
23 $url = Read-Host "Enter URL Here"
24 ./yt-dlp.exe -x -f 'ba' --audio-format mp3 -o $HOME'\Music\YouTube\output\%(title)s.%(ext)s' $url
28 elseif($Type -eq "video"){
29 $url = Read-Host "Enter URL Here"
30 ./yt-dlp.exe -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b' -o $HOME'\Video\output\%(title)s.%(ext)s' $url
34 Write-Output "Response must be 'Audio' or 'Video'!"