自動點擊 Claim 按鈕的腳本

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

当前为 2024-11-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 自動點擊 Claim 按鈕的腳本
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description 自動點擊 "Claim" 按鈕,處理 CAPTCHA 並循環操作
  6. // @author Your Name
  7. // @match *://*/* // 這裡可以替換為特定的水龍頭網站 URL
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function clickClaimButton() {
  16. const buttons = Array.from(document.querySelectorAll("button, a")); // 查找所有按鈕和鏈接
  17. const claimButton = buttons.find(btn => btn.textContent.trim().toLowerCase() === 'claim');
  18.  
  19. if (claimButton) {
  20. claimButton.click();
  21. console.log('已點擊 Claim 按鈕!');
  22. } else {
  23. console.log('找不到 Claim 按鈕。');
  24. }
  25. }
  26.  
  27. function refreshPage() {
  28. console.log('因為 CAPTCHA 而刷新頁面...');
  29. location.reload();
  30. }
  31.  
  32. function startProcess() {
  33. setTimeout(() => {
  34. if (document.body.innerText.includes('CAPTCHA')) {
  35. refreshPage();
  36. } else {
  37. clickClaimButton();
  38. }
  39. startProcess(); // 循環調用
  40. }, 10000); // 等待10秒
  41. }
  42.  
  43. // 啟動腳本
  44. startProcess();
  45. })();