Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # If you want to change the website, pls look into the file start_rule34xxx.ps1 (https://pastebin.com/H4LAjX7b)
- # There are some pointers on how to start and do this.
- $waifu = Read-Host -Prompt "Waifu name?"
- $auto_complete_url = "https://gelbooru.com/index.php?page=autocomplete2&term=$waifu"
- $response = Invoke-WebRequest $auto_complete_url
- $array_of_completions = $response.Content | ConvertFrom-Json
- if($array_of_completions.Length -gt 1)
- {
- Write-Host "Found multiple choices for your waifu."
- $completions = $response.Content | ConvertFrom-Json | ForEach-Object { $_.Value }
- for($i = 1; $i -le $completions.Length; $i++)
- {
- Write-Host "${i}:" $completions[$i - 1]
- }
- $hasChosenNumber = $false
- while(-not $hasChosenNumber)
- {
- $number = Read-Host "Please select the number you intended."
- $number = $number - '0'
- if($number -match "\d" -and $number -le $completions.Length -and $number -ge 1)
- {
- $waifu = $completions[$number - 1]
- $hasChosenNumber = $true
- }
- else
- {
- Write-Host "Please enter a valid number (e.g. 1)"
- }
- }
- Write-Host ""
- Write-Host "You have chosen '$waifu' as a waifu."
- Write-Host "Images will now be downloaded. After the download please write the same name on the solitair start-up."
- Write-Host ""
- Write-Host "E.g. if Morgana from League of Legends is your waifu, you should write 'morgana_(league_of_legends)' and not only 'morgana'."
- Write-Host "You can select the name between the 's and press enter to copy the text. Then just paste it by pressing right click into the console window."
- Write-Host ""
- }
- else
- {
- Write-Host ""
- Write-Host "You have chosen '$waifu' as a waifu."
- Write-Host "Images will now be downloaded. After the download please write the same name on the solitair start-up."
- Write-Host "You can select the name between the 's and press enter to copy the text. Then just paste it by pressing right click into the console window."
- Write-Host ""
- }
- $waifu_path = "waifus\$waifu"
- if (-not (Test-Path $waifu_path))
- {
- mkdir "waifus\$waifu" | Out-Null
- $full_page = $true
- $match_count = 0
- $page = 0
- while($full_page -and $page -lt 3)
- {
- $start_page_id = 42 * $page
- $main_url_base = "https://gelbooru.com/index.php?page=post&s=list&tags=$waifu+rating%3aexplicit+sort%3ascore%3adesc+-animated_gif+-animated+-webm+-solo&pid=$start_page_id"
- $response = Invoke-WebRequest $main_url_base -UseBasicParsing
- $url_pattern = '<a id="p.\d*" href="(.*?)"'
- ($response.Content | Select-String -Pattern $url_pattern -AllMatches).Matches.Value |
- ForEach-Object {
- $_ -match $url_pattern | Out-Null
- $match_count = ($match_count + 1);
- $url = ($Matches[1] -replace "amp;","")
- $response = Invoke-WebRequest $url
- $response.Content -match 'href="(https://img\d.gelbooru.com/images/.*?\.(.*?))"' | Out-Null
- $out_path = "$waifu_path\$match_count." + $Matches[2]
- Invoke-WebRequest $Matches[1] -OutFile $out_path | Out-Null
- if ($match_count % 10 -eq 0)
- {
- Write-Host "Downloaded $match_count images so far."
- }
- }
- $page++
- $full_page = $match_count -eq 42
- }
- }
- .\waifu_solitaire.exe
Add Comment
Please, Sign In to add comment