Created
March 7, 2018 05:38
-
-
Save chrisbrownie/c83cddcc08ce879e3e3e26fc3761f8ad to your computer and use it in GitHub Desktop.
Gets the current Virgin Australia happy hour deals. It's not great but it bloody works and that's all that matters
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
$HHUrl = "http://happyhour.virginaustralia.com/sale-on" | |
$page = Invoke-WebRequest -Uri $HHUrl | |
$flightDivs = $page.ParsedHtml.body.getElementsByClassName('card-flight') | |
foreach ($flightDiv in $flightDivs) { | |
New-Object -TypeName PSObject -Property @{ | |
"From" = $flightDiv.getElementsByTagName("h3")[0].innerText.Split("`n")[0].Trim() -replace '\ to', '' | |
"To" = $flightDiv.getElementsByTagName("h3")[0].innerText.Split("`n")[1].Trim() | |
"Details" = $flightDiv.getElementsByClassName("details")[0].innerText.Trim() | |
"Price" = $flightDiv.getelementsByClassName("price")[0].innerText.Split('$')[1].Split('*')[0].Trim() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment