Auto click Claim Button

自動點擊 "Claim" 按鈕,處理 CAPTCHA 並循環操作

Ekde 2024/11/21. Vidu La ĝisdata versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Auto click Claim Button
// @namespace    Auto click Claim Button
// @version      1.0
// @description  自動點擊 "Claim" 按鈕,處理 CAPTCHA 並循環操作
// @author       Your Name
// @match        *://*/*  // 這裡可以替換為特定的水龍頭網站 URL
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function clickClaimButton() {
        const buttons = Array.from(document.querySelectorAll("button, a")); // 查找所有按鈕和鏈接
        const claimButton = buttons.find(btn => btn.textContent.trim().toLowerCase() === 'claim');

        if (claimButton) {
            claimButton.click();
            console.log('已點擊 Claim 按鈕!');
        } else {
            console.log('找不到 Claim 按鈕。');
        }
    }

    function refreshPage() {
        console.log('因為 CAPTCHA 而刷新頁面...');
        location.reload();
    }

    function startProcess() {
        setTimeout(() => {
            if (document.body.innerText.includes('CAPTCHA')) {
                refreshPage();
            } else {
                clickClaimButton();
            }
            startProcess(); // 循環調用
        }, 10000); // 等待10秒
    }

    // 啟動腳本
    startProcess();
})();