Last active
September 2, 2015 00:08
-
-
Save sduensin/6aa5ff6d3972ded211b8 to your computer and use it in GitHub Desktop.
Automatic contest clicker
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
/* | |
Use http://slimerjs.org to run this. | |
First, run: slimerjs -CreateProfile clicker | |
Then run: slimerjs -P clicker clicker.js | |
The first time it pops up, you will need to sign into FB. Be sure to click "Remember me". | |
*/ | |
var page = require("webpage").create(); | |
var STATE_START_LOAD = 0; | |
var STATE_WAITING_LOAD_FINISH = 1; | |
var state = STATE_START_LOAD; | |
var seconds = 0; | |
var interval = setInterval(function() { | |
if (state == STATE_START_LOAD) { | |
page.open("http://a.pgtb.me/Kh37TR?embed=1&v_offset=0&autoscroll_p=1"); | |
console.log("Page loaded."); | |
state = STATE_WAITING_LOAD_FINISH; | |
seconds = 62; | |
} | |
if (state == STATE_WAITING_LOAD_FINISH) { | |
console.log("Waiting " + seconds + " until click."); | |
seconds--; | |
if (seconds <= 0) { | |
console.log("Clicking!"); | |
page.evaluateAsync(function() { | |
var li = document.getElementById('my_db_entry_98562893'); | |
var a = li.getElementsByTagName('a')[0]; | |
a.click(); | |
}); | |
state = STATE_START_LOAD; | |
} | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment