Bumble Unblur with Names

Unblur Bumble beeline profiles and show names

// ==UserScript==
// @name         Bumble Unblur with Names
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Unblur Bumble beeline profiles and show names
// @match        https://bumble.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function getAuthToken() {
        // Buscar el token de autenticación en el localStorage
        const bumbleData = localStorage.getItem("bumble-app");
        if (bumbleData) {
            try {
                const parsed = JSON.parse(bumbleData);
                return parsed?.session?.access_token || null;
            } catch (e) {
                console.error("Error parsing Bumble data:", e);
                return null;
            }
        }
        return null;
    }

    async function unblur() {
        const authToken = getAuthToken();
        if (!authToken) {
            console.error("Bumble Unblur: Auth token not found.");
            return;
        }

        try {
            // Hacer la petición a la API de Bumble para obtener los perfiles
            const response = await fetch("https://bumble.com/mwebapi.phtml?SERVER_GET_ENCOUNTERS", {
                method: "POST",
                headers: {
                    "Authorization": `Bearer ${authToken}`,
                    "Content-Type": "application/json",
                    "X-Client-Version": "4.13.0",
                },
                body: JSON.stringify({
                    "$gpb": "badoo.bma.BadooMessage",
                    "body": [{
                        "message_type": 245,
                        "server_get_encounters": {
                            "number": 10,
                            "context": 1,
                            "user_field_filter": {
                                "projection": [210, 370, 200, 230, 490, 540, 530, 560, 291, 732, 890]
                            }
                        }
                    }],
                    "message_id": 1,
                    "version": 1,
                    "is_background": false
                })
            });

            if (!response.ok) {
                console.error(`Bumble Unblur: Fetch error - ${response.statusText}`);
                return;
            }

            const data = await response.json();
            const profiles = data?.body?.[0]?.encounters?.results || [];

            // Seleccionar los elementos del beeline en el DOM
            const beelineCards = document.querySelectorAll('.encounters-user-card');

            profiles.forEach((profile, index) => {
                const card = beelineCards[index];
                if (card && profile.user) {
                    // Desblurear la imagen
                    const photos = card.querySelectorAll('.encounters-album-image');
                    photos.forEach(photo => {
                        photo.style.filter = 'none';
                    });

                    // Añadir el nombre y la edad
                    const nameDiv = document.createElement('div');
                    nameDiv.textContent = `${profile.user.name}, ${profile.user.age}`;
                    nameDiv.style.position = 'absolute';
                    nameDiv.style.bottom = '10px';
                    nameDiv.style.left = '10px';
                    nameDiv.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
                    nameDiv.style.color = 'white';
                    nameDiv.style.padding = '5px 10px';
                    nameDiv.style.borderRadius = '5px';
                    nameDiv.style.fontSize = '14px';
                    nameDiv.style.fontWeight = 'bold';
                    nameDiv.style.zIndex = '1000';

                    // Remover cualquier nombre existente antes de añadir el nuevo
                    const existingName = card.querySelector('.bumble-name-overlay');
                    if (existingName) {
                        existingName.remove();
                    }

                    nameDiv.classList.add('bumble-name-overlay');
                    card.appendChild(nameDiv);
                }
            });

            console.log("Bumble Unblur: Images unblurred and names added successfully.");
        } catch (error) {
            console.error("Bumble Unblur: Error during unblur process.", error);
        }
    }

    // Ejecutar cuando la página se carga
    window.addEventListener('load', () => {
        setTimeout(unblur, 3000);
    });

    // Observer para manejar cambios dinámicos en la página
    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {
            if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                unblur();
            }
        }
    });

    const targetNode = document.body;
    const config = { childList: true, subtree: true };
    observer.observe(targetNode, config);

    // Crear botón para activar manualmente
    const unblurButton = document.createElement('button');
    unblurButton.textContent = 'Desbloquear Perfiles';
    unblurButton.style.position = 'fixed';
    unblurButton.style.top = '10px';
    unblurButton.style.left = '50%';
    unblurButton.style.transform = 'translateX(-50%)';
    unblurButton.style.zIndex = '9999';
    unblurButton.style.backgroundColor = '#FDB333'; // Color amarillo de Bumble
    unblurButton.style.color = '#000000';
    unblurButton.style.border = 'none';
    unblurButton.style.borderRadius = '20px';
    unblurButton.style.padding = '10px 20px';
    unblurButton.style.fontSize = '16px';
    unblurButton.style.cursor = 'pointer';
    unblurButton.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.2)';
    unblurButton.style.transition = 'background-color 0.3s ease, transform 0.3s ease';

    unblurButton.addEventListener('mouseover', function() {
        unblurButton.style.backgroundColor = '#FFE033';
        unblurButton.style.transform = 'translateX(-50%) scale(1.05)';
    });

    unblurButton.addEventListener('mouseout', function() {
        unblurButton.style.backgroundColor = '#FDB333';
        unblurButton.style.transform = 'translateX(-50%) scale(1)';
    });

    unblurButton.addEventListener('click', () => {
        unblur();
        unblurButton.textContent = '¡Desbloqueado!';
        setTimeout(() => {
            unblurButton.textContent = 'Desbloquear Perfiles';
        }, 2000);
    });

    document.body.appendChild(unblurButton);
})();