-
-
Save satishbabariya/2c2b7b51af5fe84f77c6fe458477949c 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
const OKCupid = require('okcupidjs'); | |
var Promise = require('bluebird'); | |
var okc = Promise.promisifyAll(new OKCupid()); | |
const baseQuery = { i_want: "women", they_want: "men","maximum_age": 24, radius: 9999 }; | |
const search = async () => { | |
try { | |
await okc.loginAsync("", ""); | |
console.log('login done'); | |
} catch (e) { | |
console.log('Failed to login. Check your username and password in the env file.'); | |
return; | |
} | |
console.log('searching...'); | |
let count = 0; | |
const search = () => { | |
var options = { | |
} | |
// okc.getLikes(options, function (errx, res, bodyx) { | |
// //console.log("Error", errx); | |
// //console.log("bodyx", bodyx.data); | |
// bodyx.data.forEach(function (element) { | |
// console.log(element.user.userid); | |
// okc.sendMessage(element.user.userid, "Hey.", function (err, res, body) { | |
// console.log(body); | |
// }); | |
// }); | |
// // okc.like(body); | |
// }); | |
okc.search(baseQuery, function (err, res, body) { | |
body.data.forEach(function (user) { | |
console.log(user.username, user.userid); | |
return okc.like(user.userid, function (err, res, body) { | |
okc.sendMessage(user.userid, "Hey."); | |
}); | |
}); | |
var hash = body.paging.cursors.after; | |
// check termination condition, otherwise recurse | |
// if (hash != null && count <= 1) { | |
// baseQuery.after = hash; | |
// count = count + body.data.length; | |
// search(); | |
// } | |
}); | |
}; | |
search(); | |
}; | |
search(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment