Last active
July 5, 2024 04:35
-
-
Save uptownhr/888f27fcf4d636d0197dd5736514094a to your computer and use it in GitHub Desktop.
One Million Checkboxes - Checker
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
// to copy and paste in your browser console after successfully loading https://onemillioncheckboxes.com/ | |
let currentPosition = 459999 | |
function getRandomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
function check(){ | |
const inputs = document.querySelectorAll('input[type=checkbox]:not(:checked)') | |
const index = getRandomInt(0, inputs.length - 1) | |
console.warn('returning', index, inputs.length - 1) | |
return inputs[index]; | |
} | |
function movePosition(newPosition) { | |
console.warn('movePosition', newPosition); | |
const posInput = document.querySelector('.grid') | |
posInput.scrollTop = newPosition; | |
const submit = document.querySelector('button[type=submit]') | |
submit.click(); | |
currentPosition = newPosition; | |
} | |
function workflow() { | |
const nextInput = check() | |
if (nextInput) { | |
nextInput.click(); | |
console.warn('click', nextInput) | |
} else { | |
movePosition(currentPosition - 1000) | |
} | |
} | |
movePosition(currentPosition); | |
const interval = setInterval(workflow, 200) |
Hi, runing this script on multiple pages make some checkboxes to check/uncheck becouse the website can't handle it, what i can suggest is to randomize currentPosition and also setinterval at 200 is too low and can trigger the anti spam function i recomand it to be set at 300
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@LorenDB