自動點擊 "Claim" 按鈕,處理 CAPTCHA 並循環操作
当前为
// ==UserScript==
// @name 自動點擊 Claim 按鈕的腳本
// @namespace http://tampermonkey.net/
// @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();
})();