Created
September 2, 2022 06:28
-
-
Save sysnucleus/aab5fbd2a208eae1e77e6920f0412e50 to your computer and use it in GitHub Desktop.
webharvy google hotels
This file contains 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
** 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