// ==UserScript== // @name DSU每日自动签到(上云版) // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.1.5 // @description 油猴中文网论坛-DSU每日自动签到 // @author Ne-21 // @crontab * * once * * // @grant GM_notification // @grant GM_xmlhttpRequest // @grant GM_log // @cloudcat // @exportcookie domain=.tampermonkey.net.cn // ==/UserScript== return new Promise((resolve, reject) => { GM_xmlhttpRequest({ url:"https://bbs.tampermonkey.net.cn/dsu_paulsign-sign.html", method: 'GET', onload:function (xhr) { var res = xhr.responseText var formhash = getStr(res,'formhash=','"') resolve(formhash); }, }) }).then(async (formhash) => { return await new Promise((resolve_1, reject_1) => { GM_xmlhttpRequest({ method:'POST', url:'https://bbs.tampermonkey.net.cn/plugin.php?id=dsu_paulsign:sign&operation=qiandao&infloat=1&inajax=1', data:'formhash='+ encodeURIComponent(formhash) +'&qdxq=kx&qdmode=1&todaysay='+ encodeURIComponent('签到咯~~~~~~~') + '&fastreply=0', headers:{ 'content-type': 'application/x-www-form-urlencoded', 'Referer' : 'https://bbs.tampermonkey.net.cn/plugin.php?id=dsu_paulsign:sign' }, onload:function (xhr_1) { console.log(xhr_1.responseText) var res_1 = xhr_1.responseText.replace(/\s/g,"") var msg = getStr(res_1,'',']]>') console.log(!msg) if (!msg) { GM_notification('油猴中文网自动签到:\n登陆可能失效了,请重新登陆试试~') resolve_1() } GM_log(msg,"info") GM_notification('油猴中文网自动签到:\n' + msg) resolve_1() }, }) }) }); // 正则匹配 function getStr(str, start, end) { let res = str.match(new RegExp(`${start}(.*?)${end}`)) return res ? res[1] : null }