Skip to content

Instantly share code, notes, and snippets.

@maxwofford
Created March 16, 2019 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxwofford/bbbf9cff4bd1d1aac5995a0314e83b2e to your computer and use it in GitHub Desktop.
Save maxwofford/bbbf9cff4bd1d1aac5995a0314e83b2e to your computer and use it in GitHub Desktop.
last_page = false
usernames = []
function nextPage(lastPage=false) {
newUsernames = Array.from(document.querySelectorAll('.user-list-item>div>div>a')).map(a => a.innerText)
usernames = usernames.concat(newUsernames)
lastPage = document.querySelector('.next_page').className.split(' ').indexOf('disabled') != -1
if(!lastPage) {
setTimeout(() => {
document.querySelector('.next_page').click()
setTimeout(nextPage, 3000)
}, 1000)
} else {
window.localStorage.setItem('usernameArray', JSON.stringify(usernames))
}
}
nextPage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment