Last active
November 10, 2019 12:59
-
-
Save cybor97/2e7e9c176c9134808cba525d7f4b5691 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/node | |
let axios = require('axios'); | |
async function findENDLESSLY(token) { | |
while (true) { | |
await axios.post('https://chatous.com/api/enqueue', null, { | |
headers: { | |
Cookie: `connect.sid=${token};` | |
} | |
}) | |
.then(resp => console.log(resp.data.return_code === 0 ? 'Queued' : resp.data.return_code === 1500 ? 'Waiting(on queue)' : `Unknown return_code ${resp.data}`)) | |
.catch(err => console.error(err)) | |
} | |
} | |
async function init(login, password) { | |
let resp = await axios.post('https://chatous.com/api/login', | |
`login=${login}&password=${password}` | |
, { | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' | |
} | |
}); | |
let token = resp.headers['set-cookie'].pop().split('connect.sid=').pop().split(';').shift(); | |
findENDLESSLY(token); | |
} | |
init(process.argv[2], process.argv[3]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment