Created
May 16, 2021 12:22
-
-
Save catthehacker/c1e0badbf6222ff1a774946527983347 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[int64]$i = 1, | |
[string]$PHPSESSID = '', | |
[string]$ARP = '0', | |
[string]$CFUUID = '', | |
[string]$type = 'world_link' | |
) | |
do { | |
Write-Progress -Activity ('Grabbing page: ' + $i) | |
$Headers = @{ | |
"method" = "GET" | |
"authority" = "www.planetminecraft.com" | |
"scheme" = "https" | |
"path" = "/projects/?share=$type&order=order_downloads&p=$i" | |
"pragma" = "no-cache" | |
"cache-control" = "no-cache" | |
"upgrade-insecure-requests" = "1" | |
"dnt" = "1" | |
"user-agent" = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.60" | |
"accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" | |
"sec-fetch-site" = "same-origin" | |
"sec-fetch-mode" = "navigate" | |
"sec-fetch-user" = "?1" | |
"sec-fetch-dest" = "document" | |
"referer" = "https://www.planetminecraft.com/projects/?share=$type&order=order_downloads&p=$($i = $($i-1 -lt 1) ? 1 : $i)" | |
"accept-encoding" = "gzip, deflate, br" | |
"accept-language" = "en-GB,en;q=0.9,en-US;q=0.8,mt;q=0.7" | |
"cookie" = "__cfduid=$CFUUID; PHPSESSID=$PHPSESSID; arp_scroll_position=$ARP" | |
} | |
$Page = Invoke-WebRequest -Uri "https://www.planetminecraft.com/projects/?share=$type&order=order_downloads&p=$i" -Headers $Headers | |
if ($Null -ne $Page.Headers.'Set-Cookie') { | |
Write-Output $($Page.Headers.'Set-Cookie' -split ';')[0] | |
Set-Variable -Name 'NewCookie' = ($Page.Headers.'Set-Cookie' -split ';')[0] | |
Set-Variable -Name 'NewCookie' -Value ($NewCookie -split '=') | |
Set-Variable -Name $NewCookie[0] -Value $NewCookie[1] | |
Write-Output ($NewCookie[0] + ' value: ' + $NewCookie[1]) | |
} | |
Write-Output ('Request page: ' + $i + ' ' + ($Page.Links | Where-Object { $_.href -eq '#currentpage' } | Select-Object -First 1).Title) | |
$ConvertedPage = ConvertFrom-Html $Page.Content | |
$Projects = $Page.Links.href | Where-Object { $_ -like '/project/*/' -and $_ -notlike '/projects/?*' -and $_ -notlike '/projects/*/?' } | Sort-Object -Unique | |
$Projects | ForEach-Object { $($_ -split '/')[2] | Out-File -LiteralPath './projects.txt' -Append } | |
$Members = $Page.Links.href | Where-Object { $_ -like '/member/*' } | Sort-Object -Unique | |
$Members | ForEach-Object { $($_ -split '/')[2] | Out-File -LiteralPath './members.txt' -Append } | |
$i++ | |
Start-Sleep -Seconds 5 | |
}while ($true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment