catbox_downloader/downloader.ps1
2024-01-07 20:01:38 +09:00

38 lines
No EOL
802 B
PowerShell

# Catbox Downloader Script by Yuuki
# © https://raiza.dev/ - 2024-20XX
Get-ChildItem "./" -Filter "y2k12-*.txt" |
Foreach-Object {
$index = 0
$fileNames = @()
$content = Get-Content $_.FullName
$links = ""
ForEach ($line in $($content -split "`r`n"))
{
If ($line.StartsWith("mv ")) {
$f = $line.Substring($line.IndexOf('y2k12-'))
$fileNames += $f
}
}
ForEach ($line in $($content -split "`r`n"))
{
If ($line.StartsWith("https://files.catbox.moe/"))
{
$f = $line.Substring($line.IndexOf(".moe/") + 5)
If ([System.IO.File]::Exists($fileNames[$index]))
{
Write-Host "File already downloaded."
}
Else
{
Write-Host "Downloading" $fileNames[$index] "(" $line ")"
Invoke-WebRequest -Uri $line -OutFile $fileNames[$index]
}
$index += 1
}
}
}