您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
问卷自动填写
当前为
// ==UserScript== // @name Cover问卷自动填写脚本 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 问卷自动填写 // @author nameless andy // @match https://cover-corp.com/contact // @grant GM_xmlhttpRequest // @connect * // ==/UserScript== (function() { 'use strict'; // Your code here... //常用常量、变量 const AnameInput = document.querySelector("#wpforms-1187-field_1") const AemailInput = document.querySelector("#wpforms-1187-field_2") const AtitleInput = document.querySelector("#wpforms-1187-field_3") const AdespInput = document.querySelector("#wpforms-1187-field_4")//一般 const BnameInput = document.querySelector("#wpforms-1190-field_1") const BemailInput = document.querySelector("#wpforms-1190-field_2") const BtitleInput = document.querySelector("#wpforms-1190-field_3") const BdespInput = document.querySelector("#wpforms-1190-field_4")//企业 const CnameInput = document.querySelector("#wpforms-2648-field_1") const CemailInput = document.querySelector("#wpforms-2648-field_2") const CtitleInput = document.querySelector("#wpforms-2648-field_3") const CdespInput = document.querySelector("#wpforms-2648-field_4")//取材のご依頼 const DnameInput = document.querySelector("#wpforms-2399-field_1") const DemailInput = document.querySelector("#wpforms-2399-field_2") const DtitleInput = document.querySelector("#wpforms-2399-field_3") const DdespInput = document.querySelector("#wpforms-2399-field_4") const DtypeInput = document.querySelector("#wpforms-2399-field_6")//english const EnameInput = document.querySelector("#wpforms-2400-field_1") const EemailInput = document.querySelector("#wpforms-2400-field_2") const EtitleInput = document.querySelector("#wpforms-2400-field_3") const EdespInput = document.querySelector("#wpforms-2400-field_4")//中文 const data_site_key = '6LcKHNMZAAAAAIHPRddKshmmiUOzWOodCCCs4SBO'; var service_key = ''//填入你的2Captcha的servicekey const pageurl = 'https://cover-corp.com/contact' var apiurl = "https://2captcha.com/in.php?key=" + service_key + "&method=userrecaptcha&googlekey=" + data_site_key + "&pageurl=" + pageurl var arrayname = null var arrayemail = null var arraytitle = null var arraydesp = null if(!sessionStorage.mystatus){ sessionStorage.mystatus="standby" } //standby,autofill,autosubmit //ui相关 let div = document.createElement('div');//控制台 let css = 'background: #ffffff;\ overflow: hidden;z-index: 999;\ position: fixed;padding:5px;\ text-align:center;\ width: 256px;\ height: 640px;box-sizing: content-box;\ border: 1px solid #87CEFA;\ border-radius: 5px;\ right: 10px;\ top: 15%;\ font-size:10px\ display: block'; //主程序 maincode_init() maincode_maincycle() //模块 function maincode_init(){ div.style.cssText = css; div.innerHTML = '\ <div id = "in_div">\ <p id="p_status">待机</p>\ <textarea cols="8" rows="2" id="in_name" placeholder="名字"></textarea>\ <textarea cols="8" rows="2" id="in_email" placeholder="邮箱"></textarea>\ <textarea cols="8" rows="2" id="in_title" placeholder="标题"></textarea>\ <textarea cols="8" rows="2" id="in_desp" placeholder="内容"></textarea>\ <input type="password" id="in_apikey" placeholder="2CaptchaApiKey(选填)"/>\ </div>\ <div id = "btn_div" style="float:left;">\ <button id="btn_fill" style="background: #87CEFA; color: #FFFFFF; padding: 5px; font-size: 12px;">普通填空</button>\ <button id="btn_autofill" style=" background: #87CEFA; color: #FFFFFF; padding: 5px; font-size: 12px;">自动填空</button>\ <button id="btn_autosubmit" style=" background: #87CEFA; color: #FFFFFF; padding: 5px; font-size: 12px;">自动发送(需key)</button>\ <button id="btn_info" style=" background: #87CEFA; color: #FFFFFF; padding: 5px; font-size: 12px;">使用说明</button>\ </div>\ <div id = "cbox_div">\ <select id="sel">\ <option value ="optionA">一般の方</option>\ <option value ="optionB">企業の方</option>\ <option value="optionC">取材のご依頼</option>\ <option value="optionD">For English-speakers</option>\ <option value="optionE">对于中文</option>\ </select>\ <p id = "p_status"></p>\ </div>' div.style.setProperty('display','block'); document.body.appendChild(div); document.getElementById('btn_fill').onclick = () => { if(sessionStorage.mystatus=="standby"){ module_fill() } }; document.getElementById('btn_autofill').onclick = () => { if(sessionStorage.mystatus=="standby"){ if(isFull()>0){ sessionStorage.mystatus="autofill" module_setSession() location.reload(); } } else if(sessionStorage.mystatus=="autofill"){ sessionStorage.mystatus="standby" } }; document.getElementById('btn_autosubmit').onclick = () => { if(sessionStorage.mystatus=="standby"){ if(isFull()>0){ sessionStorage.mystatus="autosubmit" module_setSession() location.reload(); } } else if(sessionStorage.mystatus=="autosubmit"){ sessionStorage.mystatus="standby" } }; document.getElementById('btn_info').onclick = () => { alert("欢迎使用问卷填写脚本!当前版本0.2\n"+ "这是一个辅助填写问卷的小脚本\n"+ "普通填写:根据下方的下拉菜单填写对应表单(需手动通过reCaptcha验证并提交)\n"+ "自动填写:当表单填写并提交后,重新载入页面时会自动填写下一项表单(需手动通过reCaptcha验证并提交,且需要sessionStorage支持)\n"+ "自动发送:如果你有2Captcha的有余额可用账号的话,输入你的apikey,脚本可以自动发送请求以通过reCaptcha验证并自动提交\n"+ "(可能提交失败,原因尚不明确。由于使用了GM_xmlhttpRequest,当前仅支持Tampermonkey版本且需要临时允许跨域请求)"); }; module_getSession(); } function maincode_maincycle(){ module_autofill() setInterval(function(){ switch(sessionStorage.mystatus){ case "standby": document.getElementById('btn_fill').innerText = '普通填空' document.getElementById('btn_autofill').innerText = '自动填空' document.getElementById('btn_autosubmit').innerText = '自动发送(需KEY)' document.getElementById('p_status').innerText = '待机' break; case "autofill": document.getElementById('btn_fill').innerText = '暂不可用' document.getElementById('btn_autofill').innerText = '终止' document.getElementById('btn_autosubmit').innerText = '暂不可用' document.getElementById('p_status').innerText = '自动装填' break; case "autosubmit": document.getElementById('btn_fill').innerText = '暂不可用' document.getElementById('btn_autofill').innerText = '暂不可用' document.getElementById('btn_autosubmit').innerText = '终止' document.getElementById('p_status').innerText = '自动发送' break; } },100) module_autosubmit() } function module_getSession(){ document.getElementById('in_name').value = sessionStorage.getItem("StorageInName") document.getElementById('in_email').value = sessionStorage.getItem("StorageInEmail") document.getElementById('in_title').value = sessionStorage.getItem("StorageInTitle") document.getElementById('in_desp').value = sessionStorage.getItem("StorageInDesp") document.getElementById('in_apikey').value = sessionStorage.getItem("StorageInApiKey") if(sessionStorage.getItem("StorageSel")!=''){ document.getElementById('sel').value = sessionStorage.getItem("StorageSel"); } else{ document.getElementById('sel').value = "optionA" } } function module_setSession(){ sessionStorage.setItem("StorageInName",document.getElementById('in_name').value) sessionStorage.setItem("StorageInEmail",document.getElementById('in_email').value) sessionStorage.setItem("StorageInTitle",document.getElementById('in_title').value) sessionStorage.setItem("StorageInDesp",document.getElementById('in_desp').value) sessionStorage.setItem("StorageInApiKey",document.getElementById('in_apikey').value) sessionStorage.setItem("StorageSel",document.getElementById('sel').value) } function module_arrayload(){ arrayname = document.getElementById('in_name').value.split('\n'); arrayemail = document.getElementById('in_email').value.split('\n'); arraytitle = document.getElementById('in_title').value.split('\n'); arraydesp = document.getElementById('in_desp').value.split('\n'); } function isFull(){ if(0==document.getElementById('in_name').value.length|| 0==document.getElementById('in_email').value.length|| 0==document.getElementById('in_title').value.length|| 0==document.getElementById('in_desp').value.length|| 0==document.getElementById('sel').value.length){ alert("为空无法装填") return 0; }else{ return 1; } } function module_fill(){ if(0==document.getElementById('in_name').value.length|| 0==document.getElementById('in_email').value.length|| 0==document.getElementById('in_title').value.length|| 0==document.getElementById('in_desp').value.length|| 0==document.getElementById('sel').value.length){ alert("为空无法装填") return; } module_arrayload() switch(document.getElementById('sel').value){ case "optionA": AnameInput.value = arrayname[Math.random()*arrayname.length | 0]; AemailInput.value = arrayemail[Math.random()*arrayemail.length | 0]; AtitleInput.value = arraytitle[Math.random()*arraytitle.length | 0]; AdespInput.value = arraydesp[Math.random()*arraydesp.length | 0]; break; case "optionB": BnameInput.value = arrayname[Math.random()*arrayname.length | 0]; BemailInput.value = arrayemail[Math.random()*arrayemail.length | 0]; BtitleInput.value = arraytitle[Math.random()*arraytitle.length | 0]; BdespInput.value = arraydesp[Math.random()*arraydesp.length | 0]; break; case "optionC": CnameInput.value = arrayname[Math.random()*arrayname.length | 0]; CemailInput.value = arrayemail[Math.random()*arrayemail.length | 0]; CtitleInput.value = arraytitle[Math.random()*arraytitle.length | 0]; CdespInput.value = arraydesp[Math.random()*arraydesp.length | 0]; break; case "optionD": DnameInput.value = arrayname[Math.random()*arrayname.length | 0]; DemailInput.value = arrayemail[Math.random()*arrayemail.length | 0]; DtitleInput.value = arraytitle[Math.random()*arraytitle.length | 0]; DdespInput.value = arraydesp[Math.random()*arraydesp.length | 0]; break; case "optionE": EnameInput.value = arrayname[Math.random()*arrayname.length | 0]; EemailInput.value = arrayemail[Math.random()*arrayemail.length | 0]; EtitleInput.value = arraytitle[Math.random()*arraytitle.length | 0]; EdespInput.value = arraydesp[Math.random()*arraydesp.length | 0]; break; } } function module_autofill(){ if("autofill"==sessionStorage.mystatus||"autosubmit"==sessionStorage.mystatus){ module_fill(); switch(document.getElementById('sel').value){ case "optionA": document.getElementById('sel').value="optionB" break; case "optionB": document.getElementById('sel').value="optionC" break; case "optionC": document.getElementById('sel').value="optionD" break; case "optionD": document.getElementById('sel').value="optionE" break; case "optionE": document.getElementById('sel').value="optionA" break; } module_setSession(); }else{ return; } } function module_2Captcha(){ if(''==document.getElementById('in_apikey').value){ alert("ApiKey为空") return; } service_key = document.getElementById('in_apikey').value; apiurl = "https://2captcha.com/in.php?key=" + service_key + "&method=userrecaptcha&googlekey=" + data_site_key + "&pageurl=" + pageurl; GM_xmlhttpRequest({ method: "GET", url: apiurl, headers: { "contrn-type": "text/xml" }, onload: function(response) { // code var text = response.responseText if(text.indexOf("OK")<=-1){ alert("ERROR:in.php出错:"+text) sessionStorage.mystatus="standby" return; }else{ var resid = response.responseText.slice(3) var resurl = "https://2captcha.com/res.php?key=" + service_key + "&action=get&id=" + resid var count = 0 var req2 = setInterval( function(){ GM_xmlhttpRequest({ method: "GET", url: resurl, headers: { "contrn-type": "text/xml" }, onload: function(response2) { // code var text2 = response2.responseText if(text2.indexOf("ERROR")>-1){ alert("ERROR:res.php出错:"+text2) sessionStorage.mystatus="standby" return; } if(text2.indexOf("OK")>-1){ switch(document.getElementById('sel').value){ case "optionA": document.getElementById("g-recaptcha-response-4").innerHTML=text2.slice(3); document.getElementById("wpforms-form-2400").submit() break; case "optionB": document.getElementById("g-recaptcha-response").innerHTML=text2.slice(3); document.getElementById("wpforms-form-1187").submit() break; case "optionC": document.getElementById("g-recaptcha-response-1").innerHTML=text2.slice(3); document.getElementById("wpforms-form-1190").submit() break; case "optionD": document.getElementById("g-recaptcha-response-2").innerHTML=text2.slice(3); document.getElementById("wpforms-form-2648").submit() break; case "optionE": document.getElementById("g-recaptcha-response-3").innerHTML=text2.slice(3); document.getElementById("wpforms-form-2399").submit() break; } clearInterval(req2); }else if(count>=180000/5000){ alert("ERROR:等待时间过长") sessionStorage.mystatus="standby" return; } count=count+1; }}) },5000 ) } }}) } function module_autosubmit(){ if("autosubmit"==sessionStorage.mystatus){ module_2Captcha() } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址