Skip to content

Instantly share code, notes, and snippets.

@aarmora
Created May 6, 2021 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarmora/c0a208178b9b94a1cf7905e6538141b9 to your computer and use it in GitHub Desktop.
Save aarmora/c0a208178b9b94a1cf7905e6538141b9 to your computer and use it in GitHub Desktop.
Get tax auction properties from Wood county Texas
// Paste this in the dev tool console on the first page
// Url for first page:
// http://taxsales.lgbs.com/api/property_sales/?county=WOOD+COUNTY&in_bbox=-96.46318790270001,32.42253239680847,-94.35381290270001,33.13032370909818&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