Skip to content

Instantly share code, notes, and snippets.

@danielroedl
Last active September 28, 2023 13:11
Show Gist options
  • Save danielroedl/a321a5567e26578fae892b3fc8abf7e0 to your computer and use it in GitHub Desktop.
Save danielroedl/a321a5567e26578fae892b3fc8abf7e0 to your computer and use it in GitHub Desktop.
Simple Windows PowerShell web crawler
# Run once with a PowerShell as Admin to allow execution of script:
# set-executionpolicy remotesigned
# CONFIG
$URL = https://badlands.cc
$SEARCH_FOR = "BADLANDS 2024 INFORMATION COMING SOON3"
$WAIT_SECONDS = 10
# CONFIG-END
Add-Type -AssemblyName PresentationCore,presentationFramework
While ($true) {
$WebResponse = Invoke-WebRequest $URL
$found = $WebResponse.ToString() -split "[`r`n]" | Select-String $SEARCH_FOR
if (! $found) {
[System.Windows.MessageBox]::Show("'$SEARCH_FOR' not found on page $URL!`n`nClick OK to open Browser and end the check script.","Content changes",0)
start $URL
break
}
$date = Get-Date
echo "${date}: '$SEARCH_FOR' found in $URL"
Start-Sleep -Seconds $WAIT_SECONDS
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment