Skip to content

Instantly share code, notes, and snippets.

@marcoiosif
Last active October 26, 2022 20:58
Show Gist options
  • Save marcoiosif/18497f4111b3468f6ab46442f3d8a378 to your computer and use it in GitHub Desktop.
Save marcoiosif/18497f4111b3468f6ab46442f3d8a378 to your computer and use it in GitHub Desktop.
Tinder AutoLike
/*
* Created on Nov 13 2021
* https://gist.github.com/marcoiosif
* Author Marco iosif Constantinescu
*/
class TinderAutoLike {
constructor(seconds) {
// Convertimos segundos a milisegundos
this.delay = seconds * 1000;
console.log('Se ejecutará cada ' + seconds + ' segundos');
this.like_btn = null;
}
findLikeBtn() {
console.log('Buscando el boton de like...');
let self = this;
// Se iteran todos los spans con la clase Hidden
document.querySelectorAll('span.Hidden').forEach(function(e) {
//Si el texto es like
if(e.innerText.toLowerCase() == 'like')
{
//Se busca el boton parent
self.like_btn = self.findParentElement(e, 'button');
console.log('Boton encontrado');
return self;
}
});
return this;
}
start() {
console.log('Arrancando programa...');
if(this.like_btn === null) return this; //Si no se ha encontrado el boton no se hace nada
let self = this;
this.interval_id = setInterval(function() {
console.log('Dando like...');
self.like_btn.click();
}, this.delay);
return this;
}
stop() {
console.log('Deteniendo programa...');
//Detiene el setInterval unicamente si se ha iniciado
if(this.interval_id > 0) {
clearInterval(this.interval_id);
this.interval_id = null;
}
}
findParentElement(e, tagName)
{
return e.tagName.toLowerCase() == tagName.toLowerCase() ? e : this.findParentElement(e.parentElement, tagName);
}
}
var TinderAutoLike_Instance = new TinderAutoLike(2).findLikeBtn();
//Para arrancarlo:
TinderAutoLike_Instance.start();
//Para detenerlo:
TinderAutoLike_Instance.stop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment