Skip to content

Instantly share code, notes, and snippets.

@aarmora
Last active May 14, 2021 11:24
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/a349bc70239cd82a5ed45ac0f6533948 to your computer and use it in GitHub Desktop.
Save aarmora/a349bc70239cd82a5ed45ac0f6533948 to your computer and use it in GitHub Desktop.
This will get all tax properties from a specific Miami-Dade tax auction.
// Url to which you navigate to see all auctions
// https://www.miamidade.realforeclose.com/index.cfm?zaction=USER&zmethod=CALENDAR
// You must be in a specific auction to run the code. Example:
// https://www.miamidade.realforeclose.com/index.cfm?zaction=AUCTION&Zmethod=PREVIEW&AUCTIONDATE=06/14/2021
// Parses the data returned from propery ajax request
function parseData(data){
let html = data.retHTML;
html = html.replace(/@A/g,'<div class="');
html = html.replace(/@B/g,'</div>');
html = html.replace(/@C/g,'class="');
html = html.replace(/@D/g,'<div>');
html = html.replace(/@E/g,'AUCTION');
html = html.replace(/@F/g,'</td><td');
html = html.replace(/@G/g,'</td></tr>');
html = html.replace(/@H/g,'<tr><td ');
html = html.replace(/@I/g,'table');
html = html.replace(/@J/g,'p_back="NextCheck=');
html = html.replace(/@K/g,'style="Display:none"');
html = html.replace(/@L/g,'/index.cfm?zaction=auction&zmethod=details&AID=');
html = `<div id="cobalt-int-stuff" style="display: hidden;">${html}</div>`;
return html;
}
async function getData(totalPages) {
// <= because we are starting at 1
for (let i = 1; i <= totalPages; i++){
const response = await fetch(`https://www.miamidade.realforeclose.com/index.cfm?zaction=AUCTION&Zmethod=UPDATE&FNC=LOAD&AREA=W&PageDir=0&doR=1&tx=1620911413218&bypassPage=${i}&test=1&_=1620911413065`);
const json = await response.json();
const html = parseData(json);
$('body').append(html);
}
const auctionsHtml = $('#cobalt-int-stuff .AUCTION_ITEM');
auctions = [];
auctionsHtml.each((index, auctionToCheck) => {
const auction = {};
const auctionRows = $('table tr', auctionToCheck);
for (let row of auctionRows) {
let label = $('th', row).html();
label = label.trim().replace(' ', '');
if (label === 'ParcelID:') {
auction[label] = $('td a', row).html();;
auction['ParcelLink'] = $('a', row).attr('href');
}
else if (label !== '') {
label = label.trim().replace(' ', '');
auction[label] = $('td', row).html();
}
else {
auction['address2'] = $('td', row).html();
auction.city = auction.address2.split(',')[0];
// We're only going to deal with the first five characters
auction.zipcode = auction.address2.split(',')[1].trim().substring(0, 5);
}
}
auctions.push(auction);
});
}
// Run this command. Make sure to check total number of pages and enter that where I have "3" here
await getData(3);
// After you see "undefined", run this command
copy(auctions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment