Last active
October 26, 2022 20:58
-
-
Save marcoiosif/18497f4111b3468f6ab46442f3d8a378 to your computer and use it in GitHub Desktop.
Tinder AutoLike
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
/* | |
* 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