#Requires -Version 7 <# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2023 v5.8.227 Created on: 2024/01/08 12:09:49 AM Created by: yuuki Organization: Filename: downloader.ps1 =========================================================================== .DESCRIPTION Downloader for my Catbox game uploads. #> class Catbox { Catbox() { } [void]Download() { Get-ChildItem -Path "./" -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 } } } } } $catbox = [Catbox]::new() $catbox.Download()