Skip to content

Instantly share code, notes, and snippets.

@iamaamir
Last active August 11, 2023 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamaamir/a83954e51b50187713da39a1b2ae8ba1 to your computer and use it in GitHub Desktop.
Save iamaamir/a83954e51b50187713da39a1b2ae8ba1 to your computer and use it in GitHub Desktop.
Auto Swipe for Tinder using tampermonkey
// ==UserScript==
// @name Autinder
// @version 0.4
// @description Auto Swipe for Tinder
// @author Aamir khan
// @namespace https://github.com/iamaamir
// @match https://tinder.com/*
// @grant none
// ==/UserScript==
(function () {
'use strict';
console.log('Autinder is ready');
window.swipe = main; // exposing main on the global
setTimeout(main, 5000);
})();
// TODO: remove annoying modal for super like
function main() {
const swipeLeftProbability = 0.1;
const timeoutMs = 1500;
let startedAt = null;
const commonCss = 'color: #fff; padding: 1rem; font-size: 1.1rem';
const selectors = {
like: "LIKE",
unlike: "NOPE",
}
let likeCount = 0;
let unlikeCount = 0;
// const select = document.querySelector.bind(document);
const selectAll = document.querySelectorAll.bind(document);
const getButtonBySelector = (text) => () => [...selectAll('button.button')].find(x => x.innerText === text);
const getLike = getButtonBySelector(selectors.like);
const getUnlike = getButtonBySelector(selectors.unlike);
// -----------------------------------Main-----------------------------------
const swipe = function swipe() {
const like = getLike();
const unlike = getUnlike();
const likeProbability = Math.random() > swipeLeftProbability
const swipeRight = like && !like.disabled && likeProbability;
const swipeLeft = unlike && !unlike.disabled && !likeProbability;
if (swipeRight) {
like.click();
likeCount++;
}
if (swipeLeft) {
unlike.click();
unlikeCount++;
}
if (swipeRight || swipeLeft) {
console.clear();
startedAt = !startedAt ? new Date().toLocaleString() : startedAt;
console.log('swiping started', startedAt);
console.log(
`%cLiked ${likeCount} %c Unliked ${unlikeCount}`,
`background: #24d794; ${commonCss}`,
`background: #fd3568; ${commonCss}`,
);
}
setTimeout(swipe, Math.floor((Math.random() * timeoutMs) + timeoutMs));
};
setTimeout(swipe, 2 * timeoutMs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment