-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdating_bro.js
130 lines (109 loc) · 3.19 KB
/
dating_bro.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//Project2
//mayankmanipriyadarshi
//remove_extra_function
//time_out_set_random_time
//delete
function hasBlacklistKeywords(bio) {
const blacklist = [
'thug',
//' lb ',
];
for (item of blacklist) {
if (bio.toLowerCase().indexOf(item) !== -1) {
console.log('skipping profile, matched blacklist keyword ' + item);
return true;
}
}
return false;
}
function hasValidProfile() {
try {
const bioContainer = document.querySelector('.profileCard .profileContent .profileCard__card .BreakWord');
if (!bioContainer) return true;
const bio = bioContainer.textContent;
console.log(bio);
return !hasBlacklistKeywords(bio);
} catch (e) {
// console.log(e);
return true; // possible empty bio
}
}
function checkTinder() {
const base = "https://tinder.com/";
return window.location.href.startsWith(base + "app/recs") || window.location.href.startsWith(base + "app/matches");
}
function isMatch() {
return document.querySelector('a.active');
}
// prevent async execution
function pause(milliseconds) {
const dt = new Date();
while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}
function trickTinder() {
const infoClassName = 'focus-button-style';
const nbButtons = document.getElementsByClassName("button").length;
const buttons = document.getElementsByClassName("button")
const dislike = nbButtons === 5 ? buttons[1] : buttons[0];
const like = nbButtons === 5 ? buttons[3] : buttons[2];
// Open profile bio
const info = document.getElementsByClassName(infoClassName)[0];
if (info) {
info.click();
}
pause(600);
// Like or deslike depending on validation
if (hasValidProfile()) {
like.click();
const thereIsMatch = isMatch();
if (thereIsMatch) {
console.log('------------- IT\'S A MATCH ! -------------');
thereIsMatch.click();
}
} else {
dislike.click();
}
// If reached max likes per day then show modal and get it's content...
// Check if there is any subscription button...
if (document.getElementsByClassName('productButton__subscriptionButton').length > 0) {
// We get the counter thing
const hms = document.getElementsByClassName('Fz($ml)')[0].textContent;
// Split it at the colons
const a = hms.split(':');
// Minutes are worth 60 seconds. Hours are worth 60 minutes. 1 second = 1kmilliseconds.
// Genius... rocket science...
const seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2])
return seconds * 1000;
}
}
function checkOkCupid() {
return window.location.href.startsWith("https://www.okcupid.com/doubletake");
}
function trickOkCupid() {
// Press the like button
document.getElementsByClassName('cardactions-action--like')[0].click();
}
function getRandomPeriod() {
return Math.round(Math.random() * (2000 - 500)) + 500;
}
(function loopSasori() {
// A random period between 500ms and 2secs
let randomPeriod = getRandomPeriod();
setTimeout(function () {
randomPeriod = undefined;
if (checkTinder()) {
const delay = trickTinder();
if (delay) {
console.log('Too many likes for now, have to wait: ' + delay + ' ms');
randomPeriod = delay;
}
} else if (checkOkCupid()) {
trickOkCupid();
}
if (!randomPeriod) {
loopSasori();
} else {
setTimeout(loopSasori, randomPeriod);
}
}, randomPeriod);
}());