Last active
May 8, 2018 13:19
-
-
Save KristofferK/a9a7b44d39c0f0b86e52f7d6580e7a19 to your computer and use it in GitHub Desktop.
Auto like person on Badoo depending on amount of mutual interests. Will also print description and mutual interests to console. https://github.com/KristofferK/thirstyboy-badoo-bot/
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
(() => { | |
let liked = 0; | |
let disliked = 0; | |
const likeNextPersonAfterALike = (likedName, likedAge, iteration) => { | |
const age = parseInt(document.querySelector('.profile-header__age').innerText.substring(2)) | |
const name = document.querySelector('.profile-header__name').innerText; | |
console.log('Just liked', name, age); | |
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 likeNextPerson = () => { | |
if (!hasVotesLeft()) { | |
alert('Out of votes!'); | |
return; | |
} | |
const mutualInterestsElement = document.querySelector('[data-interests-type="count"]'); | |
const age = parseInt(document.querySelector('.profile-header__age').innerText.substring(2)) | |
const name = document.querySelector('.profile-header__name').innerText; | |
if (mutualInterestsElement != null) { | |
const mutualInterests = parseInt(document.querySelector('[data-interests-type="count"]').innerText); | |
if (mutualInterests > 2) { | |
showProfileInformation(); | |
const likedCount = liked + 1; | |
console.log(`Liking ${name} (${age}) with ${mutualInterests} mutual interests in 7.5 seconds. (Like ${likedCount})`); | |
if (getOnlineStatus().indexOf('7+') != -1) { | |
console.warn('Might be inactive user!', getOnlineStatus()); | |
} | |
window.setTimeout(printDescriptionAndMutualInterests, 500); | |
window.setTimeout(like, 7500); | |
window.setTimeout(() => { | |
likeNextPersonAfterALike(name, age, 1); | |
}, 8000); | |
return; | |
} | |
} | |
const dislikedCount = dislike(); | |
console.log(`Skipped ${name} (${age}). (Dislike ${dislikedCount})`); | |
window.setTimeout(likeNextPerson, 150); | |
}; | |
const showProfileInformation = () => { | |
const button = document.querySelector('.b-link.js-profile-header-toggle-layout'); | |
button.click(); | |
}; | |
const printDescriptionAndMutualInterests = () => { | |
const descElement = document.querySelector('.profile-section__txt'); | |
if (descElement != null) { | |
console.log(descElement.innerText); | |
} | |
const mutualInterests = [...document.querySelectorAll('.intr--match')].map(e => e.innerText.trim()); | |
console.log(mutualInterests); | |
printImages(); | |
}; | |
const printImages = () => { | |
const images = [...document.querySelectorAll('[data-lazy-url]')].map(e => e.src); | |
console.log(images); | |
}; | |
const like = () => { | |
document.querySelector('[data-choice="yes"]').click(); | |
return ++liked; | |
}; | |
const dislike = () => { | |
document.querySelector('[data-choice="no"]').click(); | |
return ++disliked; | |
}; | |
const hasVotesLeft = () => { | |
return true; | |
// return document.querySelector('ovl__header ovl__header--votes ovl__header--space') == null; | |
}; | |
const getOnlineStatus = () => { | |
const statusElement = document.querySelector('.online-status .tooltip__content'); | |
return statusElement != null ? statusElement.innerHTML.trim() : ''; | |
}; | |
likeNextPerson(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment