Skip to content

Instantly share code, notes, and snippets.

@MikeeI
Forked from jeffgca/url_scrape.js
Created February 16, 2016 06:21
Show Gist options
  • Save MikeeI/a1bec95f9ef9ee3b07fb to your computer and use it in GitHub Desktop.
Save MikeeI/a1bec95f9ef9ee3b07fb to your computer and use it in GitHub Desktop.
Just the script
// 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