西班牙华人网 西华论坛

 找回密码
 立即注册
搜索
查看: 275|回复: 5
收起左侧

用脚本抢CITA 0723 更新一下电脑版本的代码 全自动点击下一步

[复制链接]
发表于 2026-7-15 12:39:32 | 显示全部楼层 |阅读模式
本帖最后由 sherey 于 2026-7-23 12:46 编辑
  1. // ==UserScript==
  2. // @name         Auto Cita Barcelona NIE (With Audio Alert)
  3. // @namespace    http://tampermonkey.net/
  4. // @version      1.4
  5. // @description  自动预约NIE指纹 CITA (Barcelona),修复误报并加入蜂鸣声音提醒
  6. // @match        https://icp.administracionelectronica.gob.es/icpplustieb/*
  7. // @match        https://icp.administracionelectronica.gob.es/icpplus/*
  8. // @grant        none
  9. // ==/UserScript==

  10. (function() {
  11.     'use strict';

  12.     // 个人信息配置
  13.     const NIE = "X0000000X";
  14.     const FULLNAME = "MINGZI XING";
  15.     const NATIONALITY = "CHINA";

  16.     // 简单日志
  17.     function log(msg) {
  18.         console.log("[CITA] " + msg);
  19.     }

  20.     // ???? 核心功能:播放警报蜂鸣声
  21.     function playAlertSound() {
  22.         try {
  23.             const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  24.             const oscillator = audioCtx.createOscillator();
  25.             const gainNode = audioCtx.createGain();

  26.             oscillator.type = 'sine'; // 声音类型:正弦波(哔哔声)
  27.             oscillator.frequency.setValueAtTime(880, audioCtx.currentTime); // 音高:880Hz(比较清脆刺耳的高音)
  28.             gainNode.gain.setValueAtTime(0.5, audioCtx.currentTime); // 音量:0.5

  29.             oscillator.connect(gainNode);
  30.             gainNode.connect(audioCtx.destination);

  31.             oscillator.start();
  32.             // 响铃 0.8 秒后自动停止,配合外层的 setInterval 形成“哔-- 哔--”的间歇警报效果
  33.             setTimeout(() => {
  34.                 oscillator.stop();
  35.                 audioCtx.close();
  36.             }, 800);
  37.         } catch (e) {
  38.             log("播放声音失败(可能是浏览器权限限制): " + e);
  39.         }
  40.     }

  41.     // 首页:选择省份 Barcelona
  42.     if (location.pathname.endsWith("/index.html") || location.pathname.endsWith("/index")) {
  43.         log("首页:选择省份 Barcelona");
  44.         const sel = document.querySelector("select[name='form']");
  45.         if (sel) {
  46.             for (let opt of sel.options) {
  47.                 if (opt.text.toUpperCase().includes("BARCELONA")) {
  48.                     sel.value = opt.value;
  49.                     break;
  50.                 }
  51.             }
  52.             const btn = document.querySelector("input[type='submit'], button[type='submit']");
  53.             if (btn) setTimeout(() => btn.click(), 800);
  54.         }
  55.     }

  56.     // 业务选择页:选择 TOMA DE HUELLA
  57.     else if (location.pathname.includes("/citar")) {
  58.         log("业务选择页:选择 TOMA DE HUELLA");
  59.         const sel = document.querySelector("select[name='tramiteGrupo[0]']");
  60.         if (sel) {
  61.             sel.value = "4010"; // TOMA DE HUELLA
  62.             const btn = document.querySelector("input[type='submit'], button[type='submit']");
  63.             if (btn) setTimeout(() => btn.click(), 500);
  64.         }
  65.     }

  66.     // 填写个人资料页
  67.     else if (location.pathname.includes("/acEntrada")) {
  68.         log("填写个人资料(手动点击 Aceptar)");
  69.         const inputNie = document.querySelector("input[name='txtIdCitado']");
  70.         const inputName = document.querySelector("input[name='txtDesCitado']");

  71.         if (inputNie) inputNie.value = NIE;
  72.         if (inputName) inputName.value = FULLNAME;

  73.         // 自动选择国籍 CHINA
  74.         const sel = document.querySelector("select[name='txtPaisNac']");
  75.         if (sel) {
  76.             for (let opt of sel.options) {
  77.                 if (opt.text.trim().toUpperCase() === NATIONALITY.toUpperCase()) {
  78.                     sel.value = opt.value;
  79.                     break;
  80.                 }
  81.             }
  82.         }
  83.         log("【提示】个人信息已自动填好,请手动点击 Aceptar");
  84.     }

  85.     // 进入验证页:点击 SOLICITAR CITA
  86.     else if (location.pathname.includes("/acValidarEntrada")) {
  87.         log("点击 SOLICITAR CITA");
  88.         const btn = [...document.querySelectorAll("input[type='submit']")]
  89.             .find(b => b.value.toUpperCase().includes("SOLICITAR"));
  90.         if (btn) setTimeout(() => btn.click(), 500);
  91.     }

  92.     // Cita 结果页:精确检测是否有号
  93.     else if (location.pathname.includes("/acCitar")) {
  94.         const bodyText = document.body.innerText.toUpperCase();

  95.         // 1. 优先排除被防火墙拒绝或者系统崩溃的情况(防止误报有号)
  96.         if (bodyText.includes("REQUESTED URL WAS REJECTED") || bodyText.includes("FORBIDDEN") || bodyText.includes("ERROR")) {
  97.             log("❌ 糟糕,IP可能被封锁!停止自动刷新。");
  98.             alert("⚠️ 访问被防火墙拒绝(Rejected)!请切换网络(手机热点)再试。");
  99.             return;
  100.         }

  101.         // 2. 定义官方经典的几种“无号”核心提示语
  102.         const noCitaKeywords = [
  103.             "EN ESTE MOMENTO NO HAY CITAS DISPONIBLES",
  104.             "NO HAY CITAS DISPONIBLES",
  105.             "NO ENCONTRADO CITAS",
  106.             "En este momento no hay citas disponibles."
  107.         ];

  108.         // 检查页面是否包含任意一个无号关键词
  109.         const hasNoCita = noCitaKeywords.some(keyword => bodyText.includes(keyword));

  110.         if (hasNoCita) {
  111.             log("当前无号,45秒后自动刷新重试...");
  112.             setTimeout(() => location.reload(), 45000);
  113.         } else {
  114.             // 排除无号,排除报错 —— 确定有位置了!
  115.             log("???? 发现可用 CITA !!!");

  116.             // 每隔 1.5 秒鸣叫一次警报声,直到你处理页面
  117.             playAlertSound(); // 先响第一声
  118.             const soundInterval = setInterval(playAlertSound, 1500);

  119.             // 弹出提示框(点击确定后会关闭声音)
  120.             alert("???? 发现可用 CITA !!!请立刻手动选择办公室并确认!");
  121.             clearInterval(soundInterval); // 你点了弹窗的确定后,关闭警报声音
  122.         }
  123.     }

  124. })();
复制代码
以上是电脑版本。以下是手机版本。
  1. // ==UserScript==
  2. // @name         Auto Cita Barcelona NIE (Mobile Ultimate Edition)
  3. // @namespace    http://tampermonkey.net/
  4. // @version      2.0
  5. // @description  自动预约NIE指纹(手机深度优化 + 人类行为仿真 + 彻底解决Not Found)
  6. // @match        https://icp.administracionelectronica.gob.es/icpplustieb/*
  7. // @match        https://icp.administracionelectronica.gob.es/icpplus/*
  8. // @grant        none
  9. // ==/UserScript==

  10. (function() {
  11.     'use strict';

  12.     // =================================================================
  13.     // 个人信息配置(已为你保持原样)
  14.     // =================================================================
  15.     const NIE = "居留号";
  16.     const FULLNAME = "名-姓";
  17.     const NATIONALITY = "CHINA";

  18.     // 简单日志输出
  19.     function log(msg) {
  20.         console.log("[CITA] " + msg);
  21.     }

  22.     // ???? 核心功能:播放警报蜂鸣声(高频清脆哔哔声)
  23.     function playAlertSound() {
  24.         try {
  25.             const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  26.             const oscillator = audioCtx.createOscillator();
  27.             const gainNode = audioCtx.createGain();

  28.             oscillator.type = 'sine';
  29.             oscillator.frequency.setValueAtTime(880, audioCtx.currentTime); // 880Hz 刺耳高音
  30.             gainNode.gain.setValueAtTime(0.5, audioCtx.currentTime); // 音量

  31.             oscillator.connect(gainNode);
  32.             gainNode.connect(audioCtx.destination);

  33.             oscillator.start();
  34.             // 响铃 0.8 秒后自动停止,配合外层的 setInterval 形成间歇警报
  35.             setTimeout(() => {
  36.                 oscillator.stop();
  37.                 audioCtx.close();
  38.             }, 800);
  39.         } catch (e) {
  40.             log("播放声音失败(可能是浏览器权限限制): " + e);
  41.         }
  42.     }

  43.     // ????️ 移动端核心防卡:仿真人输入,并强制触发下拉菜单的系统更换事件
  44.     function simulateHumanInput(element, value) {
  45.         element.value = value;
  46.         element.dispatchEvent(new Event('input', { bubbles: true }));
  47.         element.dispatchEvent(new Event('change', { bubbles: true }));
  48.         element.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true, key: 'Enter' }));
  49.         element.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true, key: 'Enter' }));
  50.     }

  51.     // 生成随机延迟时间(让每次操作间隔都不同,完美迷惑防火墙行为审计)
  52.     function getRandomDelay(min, max) {
  53.         return Math.floor(Math.random() * (max - min + 1) + min);
  54.     }

  55.     // 1. 首页:自动选择省份 Barcelona
  56.     if (location.pathname.endsWith("/index.html") || location.pathname.endsWith("/index") || location.pathname === "/icpplustieb/" || location.pathname === "/icpplus/") {
  57.         log("首页:正在自动探测省份下拉框...");
  58.         const checkSelect = setInterval(() => {
  59.             const sel = document.querySelector("select[name='form']") || document.getElementById('provincia');
  60.             if (sel && sel.options.length > 1) {
  61.                 clearInterval(checkSelect); // 抓取成功,清除定时器
  62.                
  63.                 // 模拟人类:进页面发呆 1.2 - 2 秒再选择
  64.                 setTimeout(() => {
  65.                     for (let opt of sel.options) {
  66.                         if (opt.text.toUpperCase().includes("BARCELONA")) {
  67.                             simulateHumanInput(sel, opt.value);
  68.                             log("成功选择省份: BARCELONA");
  69.                             break;
  70.                         }
  71.                     }
  72.                     // 选完再等 1 秒多才点提交
  73.                     setTimeout(() => {
  74.                         const btn = document.querySelector("input[type='submit'], button[type='submit']");
  75.                         if (btn) { btn.click(); log("首页已成功提交"); }
  76.                     }, getRandomDelay(1000, 1500));
  77.                 }, getRandomDelay(1200, 2000));
  78.             }
  79.         }, 200);
  80.     }

  81.     // 2. 业务选择页:自动选择 TOMA DE HUELLA
  82.     else if (location.pathname.includes("/citar")) {
  83.         log("业务选择页:正在自动选择项目...");
  84.         const checkTramite = setInterval(() => {
  85.             const sel = document.querySelector("select[name='tramiteGrupo[0]']") || document.querySelector("select[id*='tramite']");
  86.             if (sel && sel.options.length > 1) {
  87.                 clearInterval(checkTramite);
  88.                
  89.                 // 模拟人类:等 1.5 到 2.5 秒再选项目
  90.                 setTimeout(() => {
  91.                     let found = false;
  92.                     for (let opt of sel.options) {
  93.                         if (opt.value === "4010" || opt.text.toUpperCase().includes("TOMA DE HUELLAS")) {
  94.                             simulateHumanInput(sel, opt.value);
  95.                             log("成功选择业务: TOMA DE HUELLAS (4010)");
  96.                             found = true;
  97.                             break;
  98.                         }
  99.                     }
  100.                     if(found) {
  101.                         // 选完再等 1.2 秒提交
  102.                         setTimeout(() => {
  103.                             const btn = document.querySelector("input[type='submit'], button[type='submit']");
  104.                             if (btn) { btn.click(); log("业务页已成功提交"); }
  105.                         }, getRandomDelay(1200, 1800));
  106.                     }
  107.                 }, getRandomDelay(1500, 2500));
  108.             }
  109.         }, 200);
  110.     }

  111.     // 3. 填写个人资料页:自动秒填数据
  112.     else if (location.pathname.includes("/acEntrada")) {
  113.         log("资料页:正在快速填写个人隐私数据...");
  114.         setTimeout(() => {
  115.             const inputNie = document.querySelector("input[name='txtIdCitado']");
  116.             const inputName = document.querySelector("input[name='txtDesCitado']");
  117.             const sel = document.querySelector("select[name='txtPaisNac']");

  118.             if (inputNie) simulateHumanInput(inputNie, NIE);
  119.             
  120.             // 故意延迟 500 毫秒填名字和国籍,模仿手速
  121.             setTimeout(() => {
  122.                 if (inputName) simulateHumanInput(inputName, FULLNAME);
  123.                 if (sel) {
  124.                     for (let opt of sel.options) {
  125.                         if (opt.text.trim().toUpperCase() === NATIONALITY.toUpperCase()) {
  126.                             simulateHumanInput(sel, opt.value);
  127.                             break;
  128.                         }
  129.                     }
  130.                 }
  131.                 log("【安全提示】所有资料已瞬间填好,请您【手动】点击大红按钮 Aceptar 提交!");
  132.             }, 500);
  133.         }, 1000);
  134.     }

  135.     // 4. 验证确认页:自动点击 SOLICITAR
  136.     else if (location.pathname.includes("/acValidarEntrada")) {
  137.         log("确认页:模拟人类阅读 1.2 秒后自动进入最后一步...");
  138.         setTimeout(() => {
  139.             const btn = [...document.querySelectorAll("input[type='submit']")]
  140.                 .find(b => b.value.toUpperCase().includes("SOLICITAR"));
  141.             if (btn) { btn.click(); log("已成功点击 SOLICITAR CITA"); }
  142.         }, getRandomDelay(1200, 1800));
  143.     }

  144.     // 5. Cita 结果页:智能判定有无号,利用后退流完美替代刷新
  145.     else if (location.pathname.includes("/acCitar")) {
  146.         const bodyText = document.body.innerText.toUpperCase();

  147.         // 优先拦截系统异常、封IP、或彻底断线的极端情况
  148.         if (bodyText.includes("NOT FOUND") || bodyText.includes("REQUESTED URL WAS REJECTED") || bodyText.includes("FORBIDDEN") || bodyText.includes("CADUCADA") || bodyText.includes("EXPIRADO")) {
  149.             log("❌ 页面异常或登录会话失效!5秒后自动强制跳回最开始的首页彻底重来...");
  150.             setTimeout(() => {
  151.                 location.href = "https://icp.administracionelectronica.gob.es/icpplustieb/index.html";
  152.             }, 5000);
  153.             return;
  154.         }

  155.         // 定义官方标准的无号关键词
  156.         const noCitaKeywords = ["EN ESTE MOMENTO NO HAY CITAS DISPONIBLES", "NO HAY CITAS DISPONIBLES", "NO ENCONTRADO CITAS", "En este momento no hay citas disponibles"];
  157.         const hasNoCita = noCitaKeywords.some(keyword => bodyText.includes(keyword));

  158.         if (hasNoCita) {
  159.             // 设置一个安全的查号等待期(35-45秒随机),防止高频刷新被系统拉黑
  160.             const reloadDelay = getRandomDelay(35000, 45000);
  161.             log(`当前暂无可用卡位。为了防止 Not Found 错误,系统将在 ${(reloadDelay/1000).toFixed(1)} 秒后自动后退并重新点进查询...`);
  162.             
  163.             setTimeout(() => {
  164.                 const btnVolver = document.querySelector("input[value='Volver'], input[value='Aceptar']");
  165.                 if (btnVolver) {
  166.                     btnVolver.click(); // 优先点击网页自带的红按钮退回第4步
  167.                     log("已模拟点击 Volver 按钮退回。");
  168.                 } else {
  169.                     history.back(); // 备用方案:通过浏览器历史记录强行后退
  170.                     log("未找到按钮,执行浏览器底层后退。");
  171.                 }
  172.             }, reloadDelay);
  173.         } else {
  174.             // 恭喜!排除所有异常和无号词,代表放号了!
  175.             log("???? 火力全开!发现可用指纹卡位 CITA !!!");

  176.             // 启动疯狂鸣叫警报机制
  177.             playAlertSound();
  178.             const soundInterval = setInterval(playAlertSound, 1500);

  179.             // 弹出强力锁屏弹窗,等你来处理
  180.             alert("???? 恭喜!系统发现可用 CITA !!!请立刻点击确定,然后以最快速度手动选择办公室并锁定你的号!");
  181.             clearInterval(soundInterval); // 一旦你手点了弹窗的确定,警报声才会关闭
  182.         }
  183.     }

  184. })();
复制代码
游客,如果您要查看本帖隐藏内容请回复


手机不自动操作的话,苹果手机看下,设置-APP-SAFARI浏览器-高级-JAVA那个打开没有。以及返回上一页,大概在中间那一块有个“扩展”,里面把USERSCRIPTS权限打开。
最好还是用电脑,最稳当。油猴里面也要设置一下,在浏览器右上方有个扩展的按钮,点开里面把油猴那个图钉图标点亮,就会出现在菜单栏,然后右键油猴那个图标-管理扩展程序-找到“允许用户运行脚本”,把这个打开。

https://icp.administracionelectronica.gob.es/icpplustieb//index.html

预约的网址。

这个代码是巴塞罗那的,其他地区的话需要稍微更改一下。找到BARCELONA字样,把它改成所在城市的名称。

这个脚本无法完全自动抢票,只是不需要一直盯着刷新而已,真的出来票,还是需要自己输入个人资料以及验证码。
真跳出来票的话,一定要记得先输入验证码,注意大小写,如果先选时间,会直接跳出来问你确定吗?然后会提示你没输入验证码,这样的话浪费太多时间,一定一定要先输入验证码!

0723 更新一下电脑版本的代码,可实现全自动点击下一步。
  1. // ==UserScript==
  2. // @name         Auto Cita Barcelona NIE (PC Fully Automatic)
  3. // @namespace    http://tampermonkey.net/
  4. // @version      3.2
  5. // @description  电脑端全自动预约NIE指纹(全自动流程 + 智能DOM监听 + 随机延迟防封 + 刺耳蜂鸣警报)
  6. // @match        https://icp.administracionelectronica.gob.es/icpplustieb/*
  7. // @match        https://icp.administracionelectronica.gob.es/icpplus/*
  8. // @grant        none
  9. // ==/UserScript==

  10. (function() {
  11.     'use strict';

  12.     // =================================================================
  13.     // 个人信息配置(替换为你真实的居留信息,建议大写)
  14.     // =================================================================
  15.     const NIE = "X0000000X";
  16.     const FULLNAME = "MINGZI XING";
  17.     const NATIONALITY = "CHINA";

  18.     // 控制台日志
  19.     function log(msg) {
  20.         console.log("[CITA-PC] " + msg);
  21.     }

  22.     // ???? 蜂鸣警报音(高频 880Hz)
  23.     function playAlertSound() {
  24.         try {
  25.             const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  26.             const oscillator = audioCtx.createOscillator();
  27.             const gainNode = audioCtx.createGain();

  28.             oscillator.type = 'sine';
  29.             oscillator.frequency.setValueAtTime(880, audioCtx.currentTime);
  30.             gainNode.gain.setValueAtTime(0.6, audioCtx.currentTime);

  31.             oscillator.connect(gainNode);
  32.             gainNode.connect(audioCtx.destination);

  33.             oscillator.start();
  34.             setTimeout(() => {
  35.                 oscillator.stop();
  36.                 audioCtx.close();
  37.             }, 800);
  38.         } catch (e) {
  39.             log("播放警报声失败: " + e);
  40.         }
  41.     }

  42.     // ???? 随机延迟函数(模拟人类反应速度,防止快速连续点击被防火墙黑单)
  43.     function getRandomDelay(min, max) {
  44.         return Math.floor(Math.random() * (max - min + 1) + min);
  45.     }

  46.     // ????️ 仿真人输入事件流
  47.     function simulateHumanInput(element, value) {
  48.         element.value = value;
  49.         element.dispatchEvent(new Event('input', { bubbles: true }));
  50.         element.dispatchEvent(new Event('change', { bubbles: true }));
  51.     }

  52.     // =================================================================
  53.     // 页面逻辑判断与自动交互
  54.     // =================================================================

  55.     // 1. 首页:选择省份 BARCELONA
  56.     if (location.pathname.endsWith("/index.html") || location.pathname.endsWith("/index") || location.pathname === "/icpplustieb/" || location.pathname === "/icpplus/") {
  57.         log("首页:正在自动选择省份 BARCELONA...");
  58.         const checkSelect = setInterval(() => {
  59.             const sel = document.querySelector("select[name='form']") || document.getElementById('provincia');
  60.             if (sel && sel.options.length > 1) {
  61.                 clearInterval(checkSelect);
  62.                 setTimeout(() => {
  63.                     for (let opt of sel.options) {
  64.                         if (opt.text.toUpperCase().includes("BARCELONA")) {
  65.                             simulateHumanInput(sel, opt.value);
  66.                             break;
  67.                         }
  68.                     }
  69.                     // 选完省份后,随机等待 1.5 - 2.5 秒点击 Aceptar
  70.                     setTimeout(() => {
  71.                         const btn = document.getElementById("btnAceptar") || document.querySelector("input[type='submit']");
  72.                         if (btn) {
  73.                             btn.click();
  74.                             log("首页:已自动点击 Aceptar");
  75.                         }
  76.                     }, getRandomDelay(1500, 2500));
  77.                 }, getRandomDelay(1000, 2000));
  78.             }
  79.         }, 300);
  80.     }

  81.     // 2. 业务选择页:自动选择按指纹 (TOMA DE HUELLAS)
  82.     else if (location.pathname.includes("/citar")) {
  83.         log("业务选择页:正在自动选择按指纹业务...");
  84.         const checkTramite = setInterval(() => {
  85.             const sel = document.querySelector("select[name='tramiteGrupo[0]']") || document.querySelector("select[id*='tramite']");
  86.             if (sel && sel.options.length > 1) {
  87.                 clearInterval(checkTramite);
  88.                 setTimeout(() => {
  89.                     let found = false;
  90.                     for (let opt of sel.options) {
  91.                         if (opt.value === "4010" || opt.text.toUpperCase().includes("TOMA DE HUELLAS")) {
  92.                             simulateHumanInput(sel, opt.value);
  93.                             found = true;
  94.                             break;
  95.                         }
  96.                     }
  97.                     if (found) {
  98.                         setTimeout(() => {
  99.                             const btn = document.getElementById("btnAceptar") || document.querySelector("input[type='submit']");
  100.                             if (btn) {
  101.                                 btn.click();
  102.                                 log("业务选择页:已自动点击 Aceptar");
  103.                             }
  104.                         }, getRandomDelay(1500, 2500));
  105.                     }
  106.                 }, getRandomDelay(1000, 2000));
  107.             }
  108.         }, 300);
  109.     }

  110.     // 2.5 中转说明页:自动选择无 Cl@ve 方式登录
  111.     else if (location.pathname.includes("/acInfo")) {
  112.         log("中转页:自动点击 Presentación sin Cl@ve...");
  113.         setTimeout(() => {
  114.             const btn = document.getElementById("btnEntrar");
  115.             if (btn) {
  116.                 btn.click();
  117.                 log("中转页:已自动点击 Presentación sin Cl@ve");
  118.             }
  119.         }, getRandomDelay(1500, 3000));
  120.     }

  121.     // 3. 填写个人资料页:秒填个人信息并自动提交
  122.     else if (location.pathname.includes("/acEntrada")) {
  123.         log("资料页:正在自动填入 NIE、姓名及国籍...");
  124.         setTimeout(() => {
  125.             const inputNie = document.querySelector("input[name='txtIdCitado']");
  126.             const inputName = document.querySelector("input[name='txtDesCitado']");
  127.             const sel = document.querySelector("select[name='txtPaisNac']");

  128.             if (inputNie) simulateHumanInput(inputNie, NIE);

  129.             setTimeout(() => {
  130.                 if (inputName) simulateHumanInput(inputName, FULLNAME);
  131.                 if (sel) {
  132.                     for (let opt of sel.options) {
  133.                         if (opt.text.trim().toUpperCase() === NATIONALITY.toUpperCase()) {
  134.                             simulateHumanInput(sel, opt.value);
  135.                             break;
  136.                         }
  137.                     }
  138.                 }
  139.                
  140.                 // 填写完成后延迟 2 - 3.5 秒自动点击提交
  141.                 setTimeout(() => {
  142.                     const btn = document.getElementById("btnEnviar") || document.querySelector("input[type='submit']");
  143.                     if (btn) {
  144.                         btn.click();
  145.                         log("资料页:已自动点击提交按钮 (btnEnviar)");
  146.                     }
  147.                 }, getRandomDelay(2000, 3500));
  148.             }, 600);
  149.         }, 1000);
  150.     }

  151.     // 4. 验证确认页:自动点击 SOLICITAR CITA
  152.     else if (location.pathname.includes("/acValidarEntrada")) {
  153.         log("验证确认页:自动点击 Solicitar Cita...");
  154.         setTimeout(() => {
  155.             const btn = document.getElementById("btnEnviar") || [...document.querySelectorAll("input[type='submit']")]
  156.                 .find(b => b.value.toUpperCase().includes("SOLICITAR"));
  157.             if (btn) {
  158.                 btn.click();
  159.                 log("验证页:已自动点击 SOLICITAR CITA");
  160.             }
  161.         }, getRandomDelay(1500, 3000));
  162.     }

  163.     // 5. Cita 结果页:精确检测卡位,无号则安全的冷却后退
  164.     else if (location.pathname.includes("/acCitar")) {
  165.         const bodyText = document.body.innerText.toUpperCase();

  166.         // 优先防范:网络异常、会话过期、或者被拦截
  167.         if (bodyText.includes("REQUESTED URL WAS REJECTED") || bodyText.includes("FORBIDDEN") || bodyText.includes("CADUCADA") || bodyText.includes("EXPIRADO") || bodyText.includes("NOT FOUND")) {
  168.             log("❌ 会话失效或请求被拒绝,5秒后彻底重定向回首页...");
  169.             setTimeout(() => {
  170.                 location.href = "https://icp.administracionelectronica.gob.es/icpplustieb/index.html";
  171.             }, 5000);
  172.             return;
  173.         }

  174.         // 判断无号的核心关键词
  175.         const hasNoCita = bodyText.includes("NO HAY CITAS") || bodyText.includes("NO HAY CITA") || bodyText.includes("NO DISPONIBLES");

  176.         if (hasNoCita) {
  177.             // 设置 30 - 45 秒随机安全冷却时间,避开频率拦截
  178.             const reloadDelay = getRandomDelay(30000, 45000);
  179.             log(`暂无可用 Cita,进入安全冷却。将在 ${(reloadDelay/1000).toFixed(1)} 秒后自动点击退回/执行后退重试...`);

  180.             setTimeout(() => {
  181.                 const btn = document.getElementById("btnSubmit") || document.querySelector("input[value='Aceptar']");
  182.                 if (btn) {
  183.                     btn.click();
  184.                     log("结果页:成功点击 btnSubmit (Aceptar) 按钮回弹");
  185.                 } else {
  186.                     log("结果页:未找到退回按钮,自动执行浏览器 history.back()");
  187.                     history.back();
  188.                 }
  189.             }, reloadDelay);
  190.         } else {
  191.             // 排除无号词及报错 —— 成功刷出 Cita!
  192.             log("???? 火力全开!电脑端检测到可用 CITA !!!");

  193.             // 持续循环播放鸣叫警报
  194.             playAlertSound();
  195.             const soundInterval = setInterval(playAlertSound, 1500);

  196.             // 强弹窗锁定,点击确定后关闭声音
  197.             alert("???????? 恭喜!电脑端检测到可用 CITA !!!\n请立刻点击确定,并以最快速度选择办公室锁号!");
  198.             clearInterval(soundInterval);
  199.         }
  200.     }

  201. })();
复制代码
0723 更新一下电脑版本的代码,可实现全自动点击下一步。



评分

参与人数 1银子 +999 收起 理由
yotranquilo + 999 给力!

查看全部评分

发表于 2026-7-15 13:20:10 该贴发自手机用户 | 显示全部楼层
谢谢分享????辛苦啦(^????^)
回复 支持 反对

使用道具 举报

发表于 2026-7-15 15:44:27 | 显示全部楼层
少数内容设置回复可见,避免帖子沉底
回复 支持 反对

使用道具 举报

发表于 2026-7-16 02:18:48 | 显示全部楼层
具体怎么样操作
回复 支持 反对

使用道具 举报

发表于 2026-7-16 09:16:12 | 显示全部楼层
具体怎么样操作
回复 支持 反对

使用道具 举报

发表于 4 天前 | 显示全部楼层
666
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关于我们|广告服务|免责声明|小黑屋|友情链接|Archiver|联系我们|手机版|西班牙华人网 西华论坛 ( 蜀ICP备05006459号 )

GMT+2, 2026-7-27 17:17 , Processed in 0.011465 second(s), 12 queries , Gzip On, Redis On.

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表
手机版