Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KristofferK/2dbe63aaf6987459f655f1c9d9f09c51 to your computer and use it in GitHub Desktop.
Save KristofferK/2dbe63aaf6987459f655f1c9d9f09c51 to your computer and use it in GitHub Desktop.
Badoo auto liker depending on multiple features.
const stats = {};
stats.likes = [];
stats.dislikes = [];
stats.likeReasons = {};
stats.dislikeReasons = {};
(() => {
let liked = 0;
let disliked = 0;
const likeNextPersonAfterALike = (likedName, likedAge, iteration) => {
const age = getAge();
const name = getName();
console.log('Just liked', likedName, likedAge);
if (iteration > 10) {
console.warn('10th iteration reached. We might be stuck here. Let\'s just continue as usual.');
likeNextPerson();
}
else if (name == likedName && age == likedAge) {
console.warn('This seems to be person we already liked. Just waiting a bit and then continuing.');
window.setTimeout(() => {
likeNextPersonAfterALike(likedName, likedAge, iteration + 1);
}, 150);
}
else {
console.log('Not same person as we just liked. Continuing as usual.');
likeNextPerson();
}
};
const shouldLike = person => {
if (person.onlineStatus.indexOf('7+') !== -1) {
return { isLike: false, message: 'User seems to be inactive.' };
}
if (person.mutualInterestsCount >= 5) {
return { isLike: true, message: '5+ mutual interests. Instant like.' };
}
const descriptionWithInterests = (person.description + '\n\n' + person.interests.map(e => e.title).join(', ')).toLowerCase();
const keywords = [':3', 'x3', ':c', 'c:', '^^', 'XD', '😺', '😹', '😽', '😻', '🙀', 'emo', 'goth', 'punk', 'anime', 'kawaii', 'lawl', 'rawr', 'black veil brides', 'bring me the horizon', 'slipknot', 'korn', 'rob zombie', 'heavy metal', 'cosplay', 'alternativ', 'japan', 'kina', 'korea', 'vietnam', 'thailand', 'asien', 'software', 'programmør', 'datamatiker', 'webudvikl', 'vegan', 'datalogi', 'computer science', 'meme', 'memes', 'maymays', 'dank'];
const keywordsMatched = keywords.filter(keyword => descriptionWithInterests.indexOf(keyword) !== -1);
if (keywordsMatched.length) {
return { isLike: true, message: 'Matched keywords: ' + keywordsMatched.join(', ') + '.' };
}
const keywordsBanned = ['datter ', 'mor ', 'søn ', 'jura ', 'crossfit'];
const keywordsBannedMatched = keywordsBanned.filter(keyword => (person.description || '').indexOf(keyword) !== -1);
if (keywordsBannedMatched.length) {
return { isLike: false, message: 'Matched banned keywords: ' + keywordsBannedMatched.join(', ') + '.' };
}
const languages = ['japansk', 'kinesisk', 'koreansk', 'vietnamesisk', 'thailandsk'];
const languagesMatched = person.languages.filter(language => languages.indexOf(language.toLowerCase()) !== -1);
if (languagesMatched.length) {
return { isLike: true, message: 'Matched languages: ' + languagesMatched.join(', ') + '.' };
}
return { isLike: false, message: 'Might not be relevant for us.' };
};
const likeNextPerson = () => {
if (!hasVotesLeft()) {
alert('Out of votes!');
return;
}
showProfileInformation();
window.setTimeout(() => {
const person = {};
person.name = getName();
person.age = getAge();
person.interests = getInterests();
person.mutualInterests = getMutualInterests();
person.mutualInterestsCount = getMutualInterestsCount();
person.languages = getLanguages();
person.description = getDescription();
person.images = getImages();
person.onlineStatus = getOnlineStatus();
person.badooScore = getBadooScore();
console.log(person);
likeResponse = shouldLike(person);
if (likeResponse.isLike) {
const likedCount = liked + 1;
stats.likes.push({person: person, reason: likeResponse});
if (!(likeResponse.message in stats.likeReasons)) {
stats.likeReasons[likeResponse.message] = 0;
}
stats.likeReasons[likeResponse.message]++;
console.log(`Liking ${person.name} (${person.age}) with ${person.mutualInterestsCount} mutual interests in 7.5 seconds. Like ${likedCount}. ${likeResponse.message}`);
window.setTimeout(like, 6500);
window.setTimeout(() => {
likeNextPersonAfterALike(person.name, person.age, 1);
}, 7000);
return;
}
const dislikedCount = dislike();
stats.dislikes.push({person: person, reason: likeResponse});
if (!(likeResponse.message in stats.dislikeReasons)) {
stats.dislikeReasons[likeResponse.message] = 0;
}
stats.dislikeReasons[likeResponse.message]++;
console.log(`Skipped ${person.name} (${person.age}). Dislike ${dislikedCount}. ${likeResponse.message}`);
window.setTimeout(likeNextPerson, 1000);
}, 1750);
};
const showProfileInformation = () => {
const button = document.querySelector('.b-link.js-profile-header-toggle-layout');
button.click();
};
const getMutualInterestsCount = () => {
const mutualInterestsElement = document.querySelector('[data-interests-type="count"]');
if (mutualInterestsElement != null) {
return parseInt(document.querySelector('[data-interests-type="count"]').innerText);
}
return -1;
};
const getMutualInterests = () => [...document.querySelectorAll('.intr--match')].map(e => e.innerText.trim());
const getName = () => document.querySelector('.profile-header__name').innerText;
const getAge = () => parseInt(document.querySelector('.profile-header__age').innerText.substring(2));
const getImages = () => [...document.querySelectorAll('[data-lazy-url]')].map(e => e.src);
const getDescription = () => {
const descElement = document.querySelector('.profile-section__txt');
if (descElement != null) {
return descElement.innerText;
}
return null;
};
const getLanguages = () => {
const languageElement = document.querySelector('.js-profile-languages-container .profile-section__content');
if (languageElement != null) {
return languageElement.innerText.split(',').map(e => e.split('(')[0].trim());
}
return [];
};
const getInterests = () => {
const interestsElements = [...document.querySelectorAll('[data-interests-id')];
if (interestsElements != null) {
return interestsElements.map(e => {
return { title: e.innerText.trim(), isMutual: e.classList.contains('intr--match') };
})
}
return null;
};
const getBadooScore = () => {
const badooScoreElement = document.querySelector('[data-score]');
if (badooScoreElement != null) {
return parseFloat(badooScoreElement.attributes['data-score'].value);
}
return null;
};
const getOnlineStatus = () => {
const statusElement = document.querySelector('.online-status .tooltip__content');
return statusElement != null ? statusElement.innerHTML.trim() : '';
};
const hasVotesLeft = () => {
return true;
// return document.querySelector('ovl__header ovl__header--votes ovl__header--space') == null;
};
const like = () => {
document.querySelector('[data-choice="yes"]').click();
return ++liked;
};
const dislike = () => {
document.querySelector('[data-choice="no"]').click();
return ++disliked;
};
likeNextPerson();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment