]> Arthur Taft Gitweb - yt-dlp-wrapper.git/blob - yt-dlp-wrapper.ps1
Add Necessary Files
[yt-dlp-wrapper.git] / yt-dlp-wrapper.ps1
1 # Set Variables
2 $Path = Join-Path -Path $HOME -ChildPath "\Documents\YouTube"
3 $exe = Join-Path -Path $Path -ChildPath "\yt-dlp.exe"
4 $val = 0
5 $url = ""
6
7 # Switch to directory with executable
8 Set-Location $Path
9
10 # Remove old executable
11 Remove-Item yt-dlp.exe
12
13 # Download new executable
14 Invoke-WebRequest https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe -OutFile $exe
15
16
17 while($val -ne 1) {
18     # Ask the user if they are downloading audio or video
19     $Type = Read-Host "Audio or Video?"
20
21     # Download audio
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
25         $val++
26     }
27     # Download video
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
31         $val++
32     }
33     else {
34         Write-Output "Response must be 'Audio' or 'Video'!"
35         continue
36     }
37 }