BitFaucet Captcha Solver Claim + Auto

Solves emoji captcha

当前为 2025-06-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         BitFaucet Captcha Solver Claim + Auto 
// @namespace    https://bitfaucet.net/
// @version      1.5
// @description  Solves emoji captcha
// @author       👽
// @match        https://bitfaucet.net/*
// @grant        none
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    let rewardClicked = false;

    function solveEmojiCaptcha() {
        const prompt = document.querySelector('.captcha-prompt[data-id="question-text"]');
        if (!prompt) return;

        const promptText = prompt.textContent.trim();
        const match = promptText.match(/click on the\s*:\s*(\w+)/i);
        if (!match || !match[1]) return;

        const targetName = match[1].toLowerCase();
        const targetGif = `${targetName}.gif`;

        console.log(`[Captcha] Looking for: ${targetGif}`);

        const emojiImages = document.querySelectorAll('.captcha-item img');
        for (const img of emojiImages) {
            const alt = img.getAttribute('alt')?.toLowerCase();
            if (alt === targetGif) {
                console.log(`[Captcha] Match found: ${alt} — clicking.`);
                img.closest('.captcha-item').click();
                return;
            }
        }

        console.warn(`[Captcha] No match found for: ${targetGif}`);
    }

    function checkForSuccessAndClaim() {
        if (rewardClicked) return;

        const successMsg = document.querySelector('.captcha-feedback.valid[data-id="validation-message"]');
        if (successMsg && successMsg.style.display !== 'none' && successMsg.textContent.includes('Verification successful!')) {
            console.log('[Captcha] Verification successful. Waiting 5 seconds before claiming...');
            rewardClicked = true;

            setTimeout(() => {
                const submitButton = document.querySelector('button#submit');
                if (submitButton) {
                    console.log('[Captcha] Clicking Get Reward button...');
                    submitButton.click();
                } else {
                    console.warn('[Captcha] Submit button not found.');
                }
            }, 5000);
        }
    }

    function clickDisagreeButton() {
        const buttons = document.querySelectorAll('button[mode="secondary"][size="large"]');
        for (const btn of buttons) {
            const span = btn.querySelector('span');
            if (span && span.textContent.trim().toUpperCase() === 'DISAGREE') {
                console.log('[Privacy Popup] Clicking DISAGREE button...');
                btn.click();
                return true;
            }
        }
        return false;
    }

    setInterval(() => {
        solveEmojiCaptcha();
        checkForSuccessAndClaim();
        clickDisagreeButton();
    }, 2000);

})();