PowerShell/dl.ps1

23 lines
585 B
PowerShell
Raw Normal View History

2023-06-18 17:37:11 +00:00
param(
2023-06-19 03:50:25 +00:00
[string]$url = "",
[validatescript({ Test-Path $_ -PathType Container })]
[system.io.fileinfo]$out = "~/Videos/Downloads/",
[string]$namepattern = "%(title)s",
[int]$wait = 60 * 10
2023-06-18 17:37:11 +00:00
)
2023-06-19 03:50:25 +00:00
$ytdlp_options = "--live-from-start --sponsorblock-remove all"
$ytdlp_options += " --wait-for-video $wait"
$ytdlp_options += " --output $out$namepattern.%(ext)s"
2023-06-18 17:37:11 +00:00
if ($url) {
2023-06-19 03:50:25 +00:00
Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
2023-06-18 17:37:11 +00:00
}
else {
while ($true) {
$url = Read-host URL
if (!$url) { break }
2023-06-19 03:50:25 +00:00
Start-Process yt-dlp -ArgumentList "$ytdlp_options $url"
2023-06-18 17:37:11 +00:00
}
}