Created
May 6, 2021 19:09
-
-
Save aarmora/27ebebd5f8363531e909038090086241 to your computer and use it in GitHub Desktop.
Get tax auction properties from Angelina county Texas
This file contains hidden or 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
// Paste this in the dev tool console on the first page | |
// Url for first page: | |
// http://taxsales.lgbs.com/api/property_sales/?county=ANGELINA+COUNTY&in_bbox=-95.62192173425001,30.916356125972055,-93.51254673425001,31.635837153739583&offset=0&ordering=precinct,sale_nbr,uid&sale_type=SALE,RESALE,STRUCK+OFF,FUTURE+SALE&state=TX | |
function getTheProperties() { | |
// Get any existing stuff | |
allThePropertiesThusFar = JSON.parse(window.localStorage.getItem('realEstateProperties')); | |
// If we don't have any yet, let's set it to an array | |
allThePropertiesThusFar = allThePropertiesThusFar ? allThePropertiesThusFar : []; | |
console.log('Total properties thus far before adding these ones', allThePropertiesThusFar.length); | |
// Get all the data on this page | |
data = JSON.parse(document.getElementsByTagName('pre').item(0).textContent); | |
// Combine the two | |
allThePropertiesThusFar.push(...data.results); | |
console.log('Total properties thus far before adding to localStorage', allThePropertiesThusFar.length); | |
window.localStorage.setItem('realEstateProperties', JSON.stringify(allThePropertiesThusFar)); | |
window.localStorage.nextUrl = data.next; | |
} | |
// Use this function to go to the next page | |
function goToNextPage() { | |
window.location.href = window.localStorage.nextUrl; | |
} | |
// Execute the two functions | |
// This first | |
getTheProperties(); | |
// This second | |
goToNextPage(); | |
// Run this command to get the results copied into your clipboard | |
copy(JSON.parse(window.localStorage.getItem('realEstateProperties'))); | |
// Go to this website to convert the data to a spreadsheet | |
// https://json-csv.com/ | |
// Command to clear the localStorage, for restarting | |
delete window.localStorage.realEstateProperties; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment