diff --git a/dl.ps1 b/dl.ps1 index 0bbf53f..fa56583 100644 --- a/dl.ps1 +++ b/dl.ps1 @@ -1,18 +1,22 @@ param( - $url = "", - $out = "~/Videos/Downloads/", - $namepattern = "%(title)s.%(ext)s" + [string]$url = "", + [validatescript({ Test-Path $_ -PathType Container })] + [system.io.fileinfo]$out = "~/Videos/Downloads/", + [string]$namepattern = "%(title)s", + [int]$wait = 60 * 10 ) -$ytdlp_options = "--live-from-start --wait-for-video 3600 --sponsorblock-remove all --output $out$namepattern $url" +$ytdlp_options = "--live-from-start --sponsorblock-remove all" +$ytdlp_options += " --wait-for-video $wait" +$ytdlp_options += " --output $out$namepattern.%(ext)s" if ($url) { - Start-Process yt-dlp -ArgumentList $ytdlp_options + Start-Process yt-dlp -ArgumentList "$ytdlp_options $url" } else { while ($true) { $url = Read-host “URL” if (!$url) { break } - Start-Process yt-dlp -ArgumentList $ytdlp_options + Start-Process yt-dlp -ArgumentList "$ytdlp_options $url" } }