Created
November 26, 2015 20:48
-
-
Save jeffgca/157bb3e59bcf4e995253 to your computer and use it in GitHub Desktop.
Just the script
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
// once you're done, the collected global should have the entire list | |
var start = $$('.a-d .a-u').length; | |
console.log('starting at', start); | |
var goal = 10000; | |
var collected; | |
var max = window.scrollMaxY; | |
window.scrollBy(0, window.scrollMaxY); | |
// console.log(max) | |
var loop; | |
function scroll() { | |
loop = setInterval(function() { | |
window.scrollBy(0, window.scrollMaxY); | |
if (window.scrollMaxY > max) { | |
max = window.scrollMaxY; | |
} else { | |
clearInterval(loop); | |
console.log("length: ", $$('.a-d .a-u').length) | |
if ($$('.a-d .a-u').length < goal) { | |
$('.h-a-Hd-mb').click(); | |
scroll(); | |
} | |
else { | |
collected = $$('.a-d .a-u'); | |
} | |
} | |
}, 2000); | |
} | |
scroll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi. Just curious, how can i execute this code. It this node.js code or do i pase this in to my browser console?
Greetings.