Last active
May 14, 2021 12:16
-
-
Save aarmora/c660f62064813b2b90743bfe25e43c3e to your computer and use it in GitHub Desktop.
This will get all tax properties from a specific Orange county, FL tax auction.
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
// Url to which you navigate to see all auctions | |
// https://myorangeclerk.realforeclose.com/index.cfm?zaction=USER&zmethod=CALENDAR | |
// You must be in a specific auction to run the code. Example: | |
// https://myorangeclerk.realforeclose.com/index.cfm?zaction=AUCTION&Zmethod=PREVIEW&AUCTIONDATE=05/25/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://myorangeclerk.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 labels = $('.ad_tab .AD_LBL', auctionToCheck); | |
for (let label of labels) { | |
let labelText = $(label).html(); | |
labelText = labelText.trim().replace(' ', ''); | |
if (labelText === 'ParcelID:') { | |
auction[labelText] = $('+ div a', label).html(); | |
auction['ParcelLink'] = $('+ div a', label).attr('href'); | |
} | |
else if (labelText === 'Case#:') { | |
auction[labelText] = $('+ div a', label).html(); | |
auction['CaseLink'] = $('+ div a', label).attr('href'); | |
} | |
else if (labelText !== '') { | |
labelText = labelText.trim().replace(' ', ''); | |
auction[labelText] = $('+ div', label).html(); | |
} | |
else { | |
auction['address2'] = $('+ div', label).html(); | |
if (auction.address2.split(',')[0]){ | |
auction.city = auction.address2.split(',')[0]; | |
} | |
if (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); | |
// Run this command to copy the auction data to your clipboard. | |
copy(auctions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment