Guest User

Untitled

a guest
Oct 15th, 2020
847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $waifu = Read-Host -Prompt "Waifu name?"
  2. $waifu_path = "waifus\$waifu"
  3.  
  4. if (-not (Test-Path $waifu_path))
  5. {
  6.     mkdir "waifus\$waifu" | Out-Null
  7.  
  8.     $full_page = $true
  9.     $match_count = 0
  10.     $page = 0
  11.  
  12.     while($full_page -and $page -lt 3)
  13.     {
  14.  
  15.         $start_page_id = 42 * $page
  16.  
  17.         $main_url_base = "https://gelbooru.com/index.php?page=post&s=list&tags=$waifu+rating%3aexplicit+sort%3ascore%3adesc+-animated_gif+-animated+-webm+solo+-absurdres&pid=$start_page_id"
  18.  
  19.         $response = Invoke-WebRequest $main_url_base
  20.  
  21.         ($response.Content | Select-String -Pattern 'js-pop" id="p.\d*" href="(.*?)"' -AllMatches).Matches.Value |
  22.         % {
  23.             $_ -match 'js-pop" id="p.\d*" href="(.*?)"' | Out-Null
  24.  
  25.             $match_count = ($match_count + 1);
  26.             $url = "https:" + ($Matches[1] -replace "amp;","")
  27.             $response = Invoke-WebRequest $url
  28.  
  29.             $response.Content -match 'href="(https://img2.gelbooru.com/images/.*?\.(.*?))"' | Out-Null
  30.  
  31.             $out_path = "$waifu_path\$match_count." + $Matches[2]
  32.        
  33.             $img = Invoke-WebRequest $Matches[1] -OutFile $out_path
  34.         }
  35.         $page++
  36.  
  37.         $full_page = $match_count -eq 42
  38.     }
  39. }
  40.  
  41. .\waifu_solitaire.exe
Add Comment
Please, Sign In to add comment