Skip to content

Instantly share code, notes, and snippets.

@sysnucleus
Last active February 28, 2023 09:41
Show Gist options
  • Save sysnucleus/eb719e32f863974255e71f36017d4b3f to your computer and use it in GitHub Desktop.
Save sysnucleus/eb719e32f863974255e71f36017d4b3f to your computer and use it in GitHub Desktop.
WebHarvy Zillow Scraping Codes
Apply Capture More Conent 4 times repeatedly for placeholder (till you get <li class=... in the Capture window), after clicking on PRICE
//---------------------------------------------------
// JS Code 1
//---------------------------------------------------
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function scrollList() {
list = document.getElementsByClassName('photo-cards')[0];
for (var i = 0; i < list.childElementCount; i++) {
list.children[i].scrollIntoView();
await sleep(100);
}
}
scrollList();
// Feb 28, 2023:
// THE FOLLOWING CODE IS NO LONGER REQUIRED. RUN ONLY THE ABOVE CODE
//---------------------------------------------------
// JS Code 2
//---------------------------------------------------
els = document.getElementsByTagName('article');
for (var i = els.length - 1; i >= 0; i--) {
if(els[i].parentElement.tagName !== 'LI') {
els[i].parentElement.parentElement.parentElement.appendChild(els[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment