Advertisement
the_votekick

PS Query Website Content

Oct 13th, 2021 (edited)
939
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $uri = "https://covidlive.com.au/vic"
  2. $data = Invoke-WebRequest $uri
  3. $table = $data.ParsedHtml.getElementsByTagName("table") | Select -first 2 | Select-Object -Skip 1
  4.  
  5. $Vic = ($table | select -ExpandProperty innertext)
  6. #Write-Host $Vic -ForegroundColor red ## Table Contents
  7. clear
  8. $Vic = $Vic.Trim("CATEGORYTOTALVARNET")
  9.  
  10. $Vic = ($Vic).Replace('New Cases',"New:")
  11. $Vic = ($Vic).Replace('Cases',"Total:")
  12. $Vic = ($Vic).Replace(' '," | ")
  13. $Vic = ($Vic).Replace(':',": ")
  14. $Vic = $Vic.Substring(0, $Vic.IndexOf('Doses'))
  15.  
  16. Write-Host "   Cases   " -ForegroundColor Black -BackgroundColor White -NoNewline
  17. Write-Host $Vic -ForegroundColor Green
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement