Skip to content

Instantly share code, notes, and snippets.

@aarmora
Last active May 7, 2021 10:38
Show Gist options
  • Save aarmora/19a9e09f125f1019dd030448183f8441 to your computer and use it in GitHub Desktop.
Save aarmora/19a9e09f125f1019dd030448183f8441 to your computer and use it in GitHub Desktop.
Get tax auction properties from Tarrant 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=TARRANT+COUNTY&in_bbox=-97.81837825%2C32.63414250204854%2C-96.76369075%2C32.908386958200026&offset=0&ordering=precinct%2Csale_nbr%2Cuid&results=50&sale_type=SALE%2CRESALE%2CSTRUCK+OFF%2CFUTURE+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