Last active
May 6, 2019 21:20
-
-
Save eduardosanzb/fff900ddb4ac27ed635c3b26bcf7a522 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Small hack to automate tinder.com; With a friendly api | |
*/ | |
function Tinder() { | |
const tinder = {}; | |
tinder._waitTime = 8000 | |
tinder.waitForIt = () => new Promise(resolve => (setTimeout(() => (resolve()), tinder._waitTime))); | |
tinder._run = true; | |
tinder.start = function(waitTime) { | |
if (waitTime) { | |
this._waitTime = waitTime | |
} | |
this._run = true; | |
this.body.next(); | |
}; | |
tinder.stop = function() { | |
this._run = false; | |
}; | |
const body = async function*() { | |
while(true) { | |
if (!this._run) { | |
console.log(`Waiting for you to change run = true; Then call tinder.start()`) | |
yield; | |
} | |
await this.waitForIt(); | |
$r.state.store.dispatch({ type: 'RECS_LIKE', payload: { method: 'BUTTON' } }) | |
} | |
}; | |
tinder.body = body.call(tinder) | |
tinder.start() | |
return tinder; | |
} | |
const tinder = Tinder(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment