Skip to content

Instantly share code, notes, and snippets.

@xsbee
Created August 2, 2022 17:23
Show Gist options
  • Save xsbee/3d29e34b2202731469c2cf159bad3470 to your computer and use it in GitHub Desktop.
Save xsbee/3d29e34b2202731469c2cf159bad3470 to your computer and use it in GitHub Desktop.
Multithreaded downloader of Lolicon.
# Inspired by https://github.com/poly000/lolicon_api
# The ultimate script to jail :)
$url = "https://api.lolicon.app/setu/v2?r18=1&num=20"
$entries = Invoke-WebRequest $url | ConvertFrom-Json
$jobs = @()
foreach ($entry in $entries.data.urls.original) {
$entryUri = [System.Uri]$entry
$fileName = Split-Path $entryUri.LocalPath -Leaf
if (!(Test-Path $fileName -PathType Leaf)) {
$jobs += Start-ThreadJob -Name $fileName -ScriptBlock {
Invoke-WebRequest $using:entry -OutFile $using:fileName
}
}
}
if ($jobs) {
Wait-Job $jobs | % {$_.Name}
}
foreach ($job in $jobs) {
Remove-Job $job
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment