Skip to content

Instantly share code, notes, and snippets.

@sysnucleus
Created September 2, 2022 06:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sysnucleus/aab5fbd2a208eae1e77e6920f0412e50 to your computer and use it in GitHub Desktop.
Save sysnucleus/aab5fbd2a208eae1e77e6920f0412e50 to your computer and use it in GitHub Desktop.
webharvy google hotels
** Important **
It is recommended to set your WebHarvy Settings > Script Load Wait Time to 10 Seconds for better results
// --------------------------------------------
// Code to scroll page to load more listings
// --------------------------------------------
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function scrollList() {
list = document.getElementsByTagName('c-wiz');;
for (var i = 0; i <= list.length-3; i++) {
list[i].scrollIntoView();
await sleep(100);
}
}
scrollList();
//--------------------------------------
// Code to collate nested listings
//--------------------------------------
els = document.getElementsByTagName('c-wiz');
parent = els[9].children[1].children[2];
for (var i = els.length - 1; i >= 0; i--) {
el = els[i];
if(el.childElementCount > 10) {
for (var j = el.children.length - 1; j >= 0; j--) {
parent.appendChild(el.children[j]);
}
}
}
// Make sure that you do not select/click on an ad
// click on the first non-ad / non-sponsored listing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment