1. 过无限debuggerFunction.prototype.__constructor_back = Function.prototype.constructor; Function.prototype.constructor = function() { if(arguments && typeof arguments[0]==='string'){ if("debugger" === arguments[0]){ return } } return Function.prototype.__constructor_back.apply(this,arguments); }2.自动答题{hide}q_list = decryptArray const span = createMessage() const sleep = async (time_delay) => { return new Promise(resolve => { setTimeout(() => { resolve() }, time_delay * 1000) }) } function createMessage() { const span = document.createElement('span') let style = `position: fixed; right: 10px; top: 80px; width: 500px; text-align: left; background-color: rgba(255, 255, 255, 0.9); z-index: 99; padding: 10px 20px; border-radius: 5px; color: #222; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2); font-weight: bold;` span.setAttribute('style', style) span.innerText = '脚本启动成功' document.body.appendChild(span) return span } function message(text = '') { span.innerHTML = text } // 添加按钮到指定父元素 const addBtn = (content, click_func = null, parent_element = '.panel-title') => { let heasers = document.querySelector(parent_element); let button = document.createElement('button'); button.innerHTML = content; button.className = 'layui-btn layui-btn-warm'; button.onclick = click_func; heasers.append(button); } async function completeCurrentQuestion(num = 1) { const question = q_list[num - 1] for (const answer of question['answer_list']) { if (answer['op'] == 1) { let op = document.querySelector(`#questions input[value="${answer['id']}"]`) if (!op) { gen(num) await sleep(0.3) op = document.querySelector(`#questions input[value="${answer['id']}"]`) } op.click() } } } async function generateQuestion(num = 1) { document.querySelector(`#btn-${num}`).click(); } const start = async () => { const func = async () => { for (let i = 1; i <= 100; i++) { generateQuestion(i) await sleep(0.3) await completeCurrentQuestion(i); await sleep(2.6) } // 等待30分钟后点击交卷 message('等待5分钟后点击交卷') await sleep(60*5) document.querySelector('body > div.container-fluid > div:nth-child(1) > div.col-md-3 > div > div.block-content.block-content-full.block-content-sm.bg-body-light.font-size-sm.text-center > button').click() await sleep(5) message('等待5秒后确认') document.querySelector('body > div.swal2-container.swal2-center.swal2-backdrop-show > div > div.swal2-actions > button.swal2-confirm').click() } if (location.pathname.includes('/user/bind')) { addBtn('获取所有答案', func, '.block-header .block-title') await sleep(3) func() } } start() {/hide}3. 自动播放视频const video_player = document.querySelector('#myVideo_html5_api') video_player.play() // 静音 video_player.volume = 0 // 16倍数 video_player.playbackRate = 1
以百度搜索建议为例后端返回数据样式({ q: "没有的", p: false, s: ["没有的英语单词", "没有的读音", "没有的近义词", "没有的事总是能胡思乱想出一些事"] });使用js处理const response = await axios.get( `https://www.baidu.com/su?wd=${encodeURIComponent(query)}&cb=hello`, ); // 提取JSON部分 const apiResponse = response.data.match(/hello\(([^)]+)\)/)[1]; const data = JSON.parse(apiResponse.replace(/(\w+)(?=:)/g, '"$1"'));