Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Site to grab
- $URL = 'http://www.bww-law.com/sales.asp'
- # Grab content
- $Result = Invoke-WebRequest $URL
- # Collection to hold the bits
- [System.Collections.ArrayList]$Properties = @{}
- # Loop through array to [hopefully] grab the
- for($i=0; $i -lt $Result.AllElements.Count; $i++)
- {
- # get rid of all the junk entries
- if(([string]::IsNullOrEmpty($Result.AllElements[$i].innerHTML)) -or ([string]::IsNullOrWhiteSpace($Result.AllElements[$i].innerHTML))) { continue }
- if(([string]::IsNullOrEmpty($Result.AllElements[$i].innerHTML.Trim())) -or ([string]::IsNullOrWhiteSpace($Result.AllElements[$i].innerHTML.Trim()))) { continue }
- if($Result.AllElements[$i].innerHTML.Trim() -like '*Jurisdiction*') { continue }
- if($Result.AllElements[$i].innerHTML -like '<TD class=subhead colSpan=8><A name="*') { $CityCounty = $Result.AllElements[$i].innerText.Trim() }
- # The innerHTML and outerHTML properties have all the details I'd be interested in
- $innerHTML = $Result.AllElements[$i].innerHTML -split "`r`n"
- # If the collection doesn't contain 8 objects, it's not valid
- if($innerHTML.Count -ne 8) { Continue }
- # Add to the collection
- $Properties += [pscustomobject]@{CityCounty = $CityCounty;
- JurisdictionFileNumber = $innerHTML[1].Replace('<TD class=bodytext width=80>','').Replace('</TD>','');
- SaleDate = $innerHTML[2].Replace('<TD class=bodytext width=65 align=center>','').Replace('</TD>','');
- SaleTime = $innerHTML[3].Replace('<TD class=bodytext width=80 align=center>','').Replace('</TD>','');
- PropertyAddress = $innerHTML[4].Replace('<TD class=bodytext width=180>','').Replace('</TD>','');
- City = $innerHTML[5].Replace('<TD class=bodytext width=120>','').Replace('</TD>','');
- Zip = $innerHTML[6].Replace('<TD class=bodytext width=90>','').Replace('</TD>','');
- OriginalLoanAmount = $innerHTML[7].Replace('<TD class=bodytext width=60 align=right>','').Replace('</TD>','');
- MapLink = "https://maps.google.com/maps?q=$($($innerHTML[4].Replace('<TD class=bodytext width=180>','').Replace('</TD>','')).Replace(' ','+'))+$City+VA+$Zip"
- SearchLink = "https://google.com/search?q=$($($innerHTML[4].Replace('<TD class=bodytext width=180>','').Replace('</TD>','')).Replace(' ','+'))+$City+VA+$Zip"
- }
- }
Add Comment
Please, Sign In to add comment