-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathautoLikeGirls.js
80 lines (56 loc) · 1.84 KB
/
autoLikeGirls.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import tinder from 'tinderjs';
import Promise from 'bluebird';
import _ from 'lodash';
import tinderauth from 'tinderauth';
process.on('unhandledRejection', console.log)
const client = Promise.promisifyAll(new tinder.TinderClient());
const email = process.env.FACEBOOK_EMAIL
const password = process.env.FACEBOOK_PASSWORD
let fbid = process.env.FACEBOOK_ID;
let fbtoken = process.env.FACEBOOK_TOKEN;
function getYearsOld(girlsBirthday){
let todaysDate = new Date();
let girlsDate = new Date(girlsBirthday)
var timeDiff = Math.abs(todaysDate.getTime() - girlsDate.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
var diffYears = Math.floor(diffDays/365)
return diffYears
}
let overallCounter = 0;
async function likeTenTinderGirls(){
let data = await client.getRecommendationsAsync(20);
if(data.message == 'recs timeout'){
setTimeout(async function(){
console.log('recs timeout error, retrying in a minute')
await likeTenTinderGirls();
}, 1000 * 60 * 2)
}
let { results } = data
let countUntil = data.results.length;
let counter = 0;
_.forEach(results, function(value, number){
let timeout = number * 2000
setTimeout(async function(){
let age = getYearsOld(value.birth_date)
overallCounter++
console.log(`We just liked ${value.name}, who is ${age} years old: ${value._id} ${overallCounter}`)
let likeResponse = await client.likeAsync(value._id)
counter++
if(counter == countUntil){
setTimeout(async function(){
await likeTenTinderGirls()
}, 15000)
}
}, timeout)
})
}
async function main(){
if(!fbid || !fbtoken){
const { fbtoken, fbid } = await tinderauth(email, password);
console.log(fbtoken, fbid);
}
client.authorize(fbtoken, fbid, async function(){
likeTenTinderGirls()
});
}
main()