Last active
January 7, 2025 01:34
-
-
Save rubenpenap/61a35c78a702b16628f2e3b5d591f021 to your computer and use it in GitHub Desktop.
Delete instagram Followers that you don´t follow.
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
(async function autoUnfollow() { | |
/** | |
* Función que inicia la animación de confeti. | |
*/ | |
function confettiAnimation() { | |
const canvas = document.createElement('canvas'); | |
canvas.style.position = 'fixed'; | |
canvas.style.top = '0'; | |
canvas.style.left = '0'; | |
canvas.style.width = '100%'; | |
canvas.style.height = '100%'; | |
canvas.style.pointerEvents = 'none'; | |
canvas.style.zIndex = '999999'; | |
document.body.appendChild(canvas); | |
const ctx = canvas.getContext('2d'); | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
const particles = []; | |
const colors = ['#ff0a54', '#ff477e', '#ff7096', '#ff85a1', '#fbb1bd', '#f9bec7', '#ffc3d1', '#ffcad4']; | |
const emojis = ['🎊', '🎈', '🍾', '🥳', '🎉']; | |
let animationRunning = true; // Variable para controlar la animación | |
// Crea partículas aleatorias | |
function createParticle() { | |
return { | |
x: Math.random() * canvas.width, | |
y: Math.random() * canvas.height - canvas.height, | |
size: Math.random() * 20 + 10, | |
speedX: Math.random() * 2 - 1, | |
speedY: Math.random() * 3 + 2, | |
rotation: Math.random() * 360, | |
rotationSpeed: Math.random() * 10 - 5, | |
type: Math.random() > 0.5 ? 'color' : 'emoji', | |
color: colors[Math.floor(Math.random() * colors.length)], | |
emoji: emojis[Math.floor(Math.random() * emojis.length)], | |
}; | |
} | |
function drawParticle(p) { | |
ctx.save(); | |
ctx.translate(p.x, p.y); | |
ctx.rotate((p.rotation * Math.PI) / 180); | |
if (p.type === 'color') { | |
ctx.fillStyle = p.color; | |
ctx.fillRect(-p.size / 2, -p.size / 2, p.size, p.size); | |
} else { | |
ctx.font = `${p.size}px Arial`; | |
ctx.textAlign = 'center'; | |
ctx.textBaseline = 'middle'; | |
ctx.fillText(p.emoji, 0, 0); | |
} | |
ctx.restore(); | |
} | |
function updateParticles() { | |
for (const particle of particles) { | |
particle.x += particle.speedX; | |
particle.y += particle.speedY; | |
particle.rotation += particle.rotationSpeed; | |
// Reaparece en la parte superior si cae fuera del canvas | |
if (particle.y > canvas.height) { | |
particle.x = Math.random() * canvas.width; | |
particle.y = -particle.size; | |
} | |
} | |
} | |
function drawMessage() { | |
const message = '¡Felicidades! Has removido de tus seguidores a todos aquellos que no seguías...'; | |
const padding = 20; | |
ctx.font = '30px Arial'; | |
ctx.textAlign = 'center'; | |
ctx.textBaseline = 'middle'; | |
const textWidth = ctx.measureText(message).width; | |
const textHeight = 40; | |
ctx.fillStyle = 'rgba(0, 0, 0, 0.7)'; | |
ctx.fillRect( | |
(canvas.width - textWidth - padding * 2) / 2, | |
(canvas.height - textHeight - padding * 2) / 2, | |
textWidth + padding * 2, | |
textHeight + padding * 2 | |
); | |
ctx.fillStyle = '#ffffff'; | |
ctx.fillText(message, canvas.width / 2, canvas.height / 2); | |
} | |
function loop() { | |
if (!animationRunning) return; // Detener la animación si no está en ejecución | |
ctx.clearRect(0, 0, canvas.width, canvas.height); | |
drawMessage(); | |
for (const particle of particles) drawParticle(particle); | |
updateParticles(); | |
requestAnimationFrame(loop); | |
} | |
for (let i = 0; i < 150; i++) particles.push(createParticle()); | |
loop(); | |
// Eliminar el canvas después de 5 segundos | |
setTimeout(() => { | |
animationRunning = false; // Detener la animación | |
document.body.removeChild(canvas); | |
console.log('Confeti terminado.'); | |
}, 5000); | |
} | |
/** | |
* Espera por el tiempo especificado. | |
* @param {number} ms - Tiempo en milisegundos. | |
* @returns {Promise<void>} | |
*/ | |
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms)); | |
// Obtener botones "Follow" | |
const followButtons = Array.from(document.querySelectorAll('body > div.x1n2onr6.xzkaem6 > div:nth-child(2) > div > div > div.x9f619.x1n2onr6.x1ja2u2z > div > div.x1uvtmcs.x4k7w5x.x1h91t0o.x1beo9mf.xaigb6o.x12ejxvf.x3igimt.xarpa2k.xedcshv.x1lytzrv.x1t2pt76.x7ja8zs.x1n2onr6.x1qrby5j.x1jfb8zj > div > div > div > div > div.x7r02ix.xf1ldfh.x131esax.xdajt7p.xxfnqb6.xb88tzc.xw2csxc.x1odjw0f.x5fp0pe > div > div > div.xyi19xy.x1ccrb07.xtf3nb5.x1pc53ja.x1lliihq.x1iyjqo2.xs83m0k.xz65tgg.x1rife3k.x1n2onr6 > div > div > div > div > div > div > div.x9f619.x1ja2u2z.x78zum5.x1n2onr6.x1iyjqo2.xs83m0k.xeuugli.x1qughib.x6s0dn4.x1a02dak.x1q0g3np.xdl72j9 > div > div > div > button > div > div')) | |
.filter(el => el.textContent.trim() === 'Follow'); | |
for (const followButton of followButtons) { | |
const parent = followButton.closest('div.x9f619.x1ja2u2z.x78zum5.x2lah0s.x1n2onr6.x1qughib.x6s0dn4.xozqiw3.x1q0g3np'); | |
if (parent) { | |
const removeButton = parent.children[2].children[0].children[0]; | |
if (removeButton) { | |
removeButton.click(); | |
console.log('Seguidores eliminados...'); | |
} | |
} | |
await delay(1000); // Pausa entre iteraciones | |
} | |
console.log('Todos los seguidores no deseados han sido removidos.'); | |
confettiAnimation(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment