// ==UserScript== // @name 吾爱破解每日定时签到【脚本猫专用】 // @version 0.3.0-beta // @description 定时脚本,每日1次,需要先登陆www.52pojie.cn。(作者不提供任何保证,使用本脚本一切后果自负,否则别用) // @author DreamNya // @grant GM_xmlhttpRequest // @grant GM_notification // @connect 52pojie.cn // @crontab 1-59 * once * * // ==/UserScript== return new Promise((resolve, reject) => { Main(); function Main(ran = false) { GM_xmlhttpRequest({ method: 'GET', url: 'https://www.52pojie.cn/home.php?mod=task&do=apply&id=2', onload: (xhr) => { console.log(xhr); const result = Check(xhr.responseText); if (result) return; try { if (ran) throw new Error('sencond run'); // 一个破签到几千行混淆? 不会真以为有人会去看吧 不会吧 不会吧 EVAL(xhr.responseText.match(/[\s\S]*<\/script>/)[0].replace(/<\/?script.*?>/g, '')); } catch (err) { console.error(err); Fail('未知错误-详见调试(吾爱开始更换签到接口 脚本随时可能失效)'); } }, ontimeout: (xhr) => { console.log(xhr); Fail('网络错误-Timeout'); }, onerror: (xhr) => { console.log(xhr); Fail('网络错误-Error'); }, }); } function EVAL(string) { const newString = string.replace(/window.*?;/, (m) => { let a = m.match(/=.*;/); if (!a) { Fail(); } else { let b = a[0]; let c = b.replace(/=|;/g, ''); if (c == b) { Fail(); } else { return `GMxhr(${c});`; } } }); eval(newString); } function GMxhr(url) { GM_xmlhttpRequest({ url: 'https://www.52pojie.cn' + url, method: 'GET', onload: (xhr) => { console.log(xhr); const result = Check(xhr.responseText); if (!result) { Fail(); } }, }); } function Fail(text = '接口更新失效') { const finalText = '吾爱破解定时签到失败-' + text; GM_notification(finalText); reject(finalText); } function Check(responseText) { const presetNotify = { '任务已完成': '吾爱破解定时签到成功', '本期您已申请过此任务': '吾爱破解定时签到失败 - 重复签到', '您需要先登录才能继续本操作': '吾爱破解定时签到失败 - 未登录', } const presetFail = { '请完成安全验证': '触发安全验证-手动消除后重试', } for (const preset in presetNotify) { if (responseText.includes(preset)) { Notify(presetNotify[preset]); return true; } } for (const preset in presetFail) { if (responseText.includes(preset)) { Fail(presetFail[preset]); return true; } } return false; } function Notify(text) { GM_notification(text); resolve(text); } });