├── Assets ├── 1024.png ├── 4ksj.png ├── 52pojie.png ├── 60s.png ├── avatar.png ├── bus.png ├── channel.jpg ├── javday.png ├── loading.gif ├── meitu.png ├── mnck.png ├── ql.png ├── tidal.jpg └── zippo.jpg ├── Private └── notify.js ├── README.md ├── Scripts ├── 91porn.js ├── BodyBMI365.js ├── ChinaMobile │ ├── NoAds.js │ ├── scripable.loon.plugin │ ├── scripable.qx.conf │ └── scripable.sgmodule ├── FanShu │ ├── No_Ads.js │ ├── fanshu.plugin │ └── fanshu.sgmodule ├── HeiLiao │ ├── app.js │ └── web.js ├── KanLiXiang │ ├── No_Ads.js │ └── klx.sgmodule ├── LockedTreasuresKeeper.js ├── Maotai │ ├── login.js │ └── msg.js ├── NeteaseCloudMusic │ ├── netease.js │ ├── netease.plugin │ └── netease.sgmodule ├── dcm.js ├── jdck-ql.js ├── kuwo.js ├── peicaise.js ├── tidal.js └── zfzn.js ├── Tasks ├── 95598 │ ├── 95598.js │ ├── 95598.scriptable │ ├── 95598.scriptable.js │ ├── 95598.weapp.js │ └── README.md ├── 1024.js ├── 4ksj.js ├── 52pojie.js ├── 60s.js ├── AutoJoinTF.js ├── Bdyy │ ├── README.md │ ├── bdyy.conf │ ├── bdyy.js │ ├── bdyy.plugin │ └── bdyy.sgmodule ├── boxjs.json ├── douban.js ├── eshop │ ├── README.md │ └── eshop.js ├── hlbdy.js ├── javbus.js ├── javday.js ├── meitu │ ├── meitu.js │ ├── meitu.sgmodule │ └── meitu.snippet ├── mi │ ├── color.png │ ├── mini.png │ └── step.js ├── moyu.js ├── ql.js ├── top.js └── zippo.js ├── Test └── import │ ├── index.min.js │ └── test.js └── Utils ├── Buffer.js ├── Buffer.min.js ├── CryptoJS.min.js ├── JSEncrypt.min.js ├── cheerio.js ├── cheerio.min.js ├── crypto.js ├── dayjs.js ├── iconv-lite.js ├── jsrsasign-part.js ├── jsrsasign.js └── notice.json /Assets/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/1024.png -------------------------------------------------------------------------------- /Assets/4ksj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/4ksj.png -------------------------------------------------------------------------------- /Assets/52pojie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/52pojie.png -------------------------------------------------------------------------------- /Assets/60s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/60s.png -------------------------------------------------------------------------------- /Assets/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/avatar.png -------------------------------------------------------------------------------- /Assets/bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/bus.png -------------------------------------------------------------------------------- /Assets/channel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/channel.jpg -------------------------------------------------------------------------------- /Assets/javday.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/javday.png -------------------------------------------------------------------------------- /Assets/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/loading.gif -------------------------------------------------------------------------------- /Assets/meitu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/meitu.png -------------------------------------------------------------------------------- /Assets/mnck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/mnck.png -------------------------------------------------------------------------------- /Assets/ql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/ql.png -------------------------------------------------------------------------------- /Assets/tidal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/tidal.jpg -------------------------------------------------------------------------------- /Assets/zippo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Assets/zippo.jpg -------------------------------------------------------------------------------- /Private/notify.js: -------------------------------------------------------------------------------- 1 | const getEnv=()=>"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":eval('typeof process !== "undefined"')?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0,notify=(e="",t="",s="",a={})=>{const n=e=>{const{$open:t,$copy:s,$media:a,$mediaMime:n}=e;switch(typeof e){case void 0:return e;case"string":switch(getEnv()){case"Surge":case"Stash":default:return{url:e};case"Loon":case"Shadowrocket":return e;case"Quantumult X":return{"open-url":e};case"Node.js":return}case"object":switch(getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{const o={};let r=e.openUrl||e.url||e["open-url"]||t;r&&Object.assign(o,{action:"open-url",url:r});let i=e["update-pasteboard"]||e.updatePasteboard||s;if(i&&Object.assign(o,{action:"clipboard",text:i}),a){let e,t,s;if(a.startsWith("http"))e=a;else if(a.startsWith("data:")){const[e]=a.split(";"),[,n]=a.split(",");t=n,s=e.replace("data:","")}else{t=a,s=(e=>{const t={JVBERi0:"application/pdf",R0lGODdh:"image/gif",R0lGODlh:"image/gif",iVBORw0KGgo:"image/png","/9j/":"image/jpg"};for(var s in t)if(0===e.indexOf(s))return t[s];return null})(a)}Object.assign(o,{"media-url":e,"media-base64":t,"media-base64-mime":n??s})}return Object.assign(o,{"auto-dismiss":e["auto-dismiss"],sound:e.sound}),o}case"Loon":{const s={};let n=e.openUrl||e.url||e["open-url"]||t;n&&Object.assign(s,{openUrl:n});let o=e.mediaUrl||e["media-url"];return a?.startsWith("http")&&(o=a),o&&Object.assign(s,{mediaUrl:o}),console.log(JSON.stringify(s)),s}case"Quantumult X":{const n={};let o=e["open-url"]||e.url||e.openUrl||t;o&&Object.assign(n,{"open-url":o});let r=e["media-url"]||e.mediaUrl;a?.startsWith("http")&&(r=a),r&&Object.assign(n,{"media-url":r});let i=e["update-pasteboard"]||e.updatePasteboard||s;return i&&Object.assign(n,{"update-pasteboard":i}),console.log(JSON.stringify(n)),n}case"Node.js":return}default:return}};switch(getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,t,s,n(a));break;case"Quantumult X":$notify(e,t,s,n(a));case"Node.js":}let o=["","==============📣系统通知📣=============="];o.push(e),t&&o.push(t),s&&o.push(s),console.log(o.join("\n"))},done=(e={})=>{switch(getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(e);break;case"Node.js":process.exit(1)}},headers=Object.fromEntries(Object.entries($request.headers).map((([e,t])=>[e.toLowerCase(),t])));$response?.body?.match(/#EXTM3U|#EXT-X-ENDLIST/)&&headers?.["x-playback-session-id"]&&"*/*"==headers?.accept&&"video"===headers?.["sec-fetch-dest"]&¬ify("完整版视频链接已经捕获成功 🛠","","点击一下此通知即可在线观看 🔞","https://m3u8play.com/?play="+encodeURIComponent($request.url)),done(); 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 免责声明 2 | 3 | - 本仓库中涉及任何解锁和解密分析的脚本仅用于资源共享和学习研究,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。 4 | 5 | - 本仓库内的任何内容禁止在中华人民共和国境内平台公开传播。 6 | 7 | - 请勿将本仓库内的任何内容用于商业或非法目的,否则后果自负。 8 | 9 | - 如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我将在收到认证文件后删除相关脚本。 10 | 11 | - 对任何本仓库中包含的脚本在使用中可能出现的问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害. 12 | 13 | - 您必须在下载后的24小时内从计算机或手机中完全删除以上内容。 14 | 15 | - 以任何方式查看此项目的人或直接或间接使用该项目的任何脚本的使用者都应仔细阅读此声明。保留随时更改或补充此免责声明的权利。一旦使用并复制了任何本仓库相关脚本或其他内容,则视为您已接受此免责声明。 16 | 17 | ### 补充说明 18 | 19 | - 本仓库内的脚本不允许商业用途,但是可以用于学习和研究,转载请保留原作者署名信息! 20 | 21 | [![Stargazers over time](https://starchart.cc/Yuheng0101/X.svg?variant=adaptive)](https://starchart.cc/Yuheng0101/X) -------------------------------------------------------------------------------- /Scripts/ChinaMobile/scripable.loon.plugin: -------------------------------------------------------------------------------- 1 | #!name= 移动余量查询服务 2 | #!desc= 供小组件使用 需配合设置参数使用 3 | #!icon=https://is1-ssl.mzstatic.com/image/thumb/Purple211/v4/92/8b/03/928b0371-20fc-288b-e4e4-05f48b7082c2/AppIcon-0-0-1x_U007emarketing-0-7-0-0-85-220.png/120x120.png 4 | #!homepage=https://github.com/ChinaTelecomOperators/ChinaMobile 5 | #!date = 2024-11-14 16:00:00 6 | 7 | [Script] 8 | http-request ^https?:\/\/api\.example\.com\/10086\/query script-path=https://github.com/ChinaTelecomOperators/ChinaMobile/releases/download/Prerelease-Alpha/10086.js, requires-body=true, timeout=60, tag=移动查询接口 9 | 10 | [MITM] 11 | hostname = api.example.com -------------------------------------------------------------------------------- /Scripts/ChinaMobile/scripable.qx.conf: -------------------------------------------------------------------------------- 1 | ^https?:\/\/api\.example\.com\/10086\/query url script-analyze-echo-response https://github.com/ChinaTelecomOperators/ChinaMobile/releases/download/Prerelease-Alpha/10086.js 2 | 3 | hostname = api.example.com -------------------------------------------------------------------------------- /Scripts/ChinaMobile/scripable.sgmodule: -------------------------------------------------------------------------------- 1 | #!name= 移动余量查询服务 2 | #!desc= 供小组件使用 需配合设置参数使用 3 | 4 | [Script] 5 | 移动查询接口 = type=http-request, pattern=^https?:\/\/api\.example\.com\/10086\/query, script-path=https://github.com/ChinaTelecomOperators/ChinaMobile/releases/download/Prerelease-Alpha/10086.js, requires-body=true, max-size=-1, timeout=60 6 | 7 | [MITM] 8 | hostname = %APPEND% api.example.com -------------------------------------------------------------------------------- /Scripts/FanShu/No_Ads.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 帆书(樊登读书)去广告 3 | * @author 𝐎𝐍𝐙𝟑𝐕 4 | * @description 全局净化 5 | * @channel https://t.me/yqc_123 6 | * @feedback https://t.me/lanjieguanggao 7 | * @date 2024-12-19 8 | * @version 1.1.2 9 | ****************************************** 10 | 脚本声明: 11 | 1. 本脚本仅用于学习研究,禁止用于商业用途 12 | 2. 本脚本不保证准确性、可靠性、完整性和及时性 13 | 3. 任何个人或组织均可无需经过通知而自由使用 14 | 4. 作者对任何脚本问题概不负责,包括由此产生的任何损失 15 | 5. 如果任何单位或个人认为该脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明、所有权证明,我将在收到认证文件确认后删除 16 | 6. 请勿将本脚本用于商业用途,由此引起的问题与作者无关 17 | 7. 本脚本及其更新版权归作者所有 18 | ******************************************/ 19 | // https://www.npmjs.com/package/base-64 20 | // prettier-ignore 21 | const base64=(()=>{var r=function(r){this.message=r};(r.prototype=new Error).name="InvalidCharacterError";var t=function(t){throw new r(t)},e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g;return{encode:function(r){r=String(r),/[^\0-\xFF]/.test(r)&&t("The string to be encoded contains characters outside of the Latin1 range.");for(var a,n,c,o,h=r.length%3,d="",i=-1,A=r.length-h;++i>18&63)+e.charAt(o>>12&63)+e.charAt(o>>6&63)+e.charAt(63&o);return 2==h?(a=r.charCodeAt(i)<<8,n=r.charCodeAt(++i),d+=e.charAt((o=a+n)>>10)+e.charAt(o>>4&63)+e.charAt(o<<2&63)+"="):1==h&&(o=r.charCodeAt(i),d+=e.charAt(o>>2)+e.charAt(o<<4&63)+"=="),d},decode:function(r){var n=(r=String(r).replace(a,"")).length;n%4==0&&(n=(r=r.replace(/==?$/,"")).length),(n%4==1||/[^+a-zA-Z0-9/]/.test(r))&&t("Invalid character: the string to be decoded is not correctly encoded.");for(var c,o,h=0,d="",i=-1;++i>(-2*h&6)));return d},version:"1.0.0"}})(); 22 | // https://www.npmjs.com/package/utf8 23 | // prettier-ignore 24 | const utf8=(()=>{var r,n,t,o=String.fromCharCode;function e(r){for(var n,t,o=[],e=0,i=r.length;e=55296&&n<=56319&&e=55296&&r<=57343)throw Error("Lone surrogate U+"+r.toString(16).toUpperCase()+" is not a scalar value")}function u(r,n){return o(r>>n&63|128)}function f(r){if(!(4294967168&r))return o(r);var n="";return 4294965248&r?4294901760&r?4292870144&r||(n=o(r>>18&7|240),n+=u(r,12),n+=u(r,6)):(i(r),n=o(r>>12&15|224),n+=u(r,6)):n=o(r>>6&31|192),n+=o(63&r|128)}function a(){if(t>=n)throw Error("Invalid byte index");var o=255&r[t];if(t++,128==(192&o))return 63&o;throw Error("Invalid continuation byte")}function c(){var o,e;if(t>n)throw Error("Invalid byte index");if(t==n)return!1;if(o=255&r[t],t++,!(128&o))return o;if(192==(224&o)){if((e=(31&o)<<6|a())>=128)return e;throw Error("Invalid continuation byte")}if(224==(240&o)){if((e=(15&o)<<12|a()<<6|a())>=2048)return i(e),e;throw Error("Invalid continuation byte")}if(240==(248&o)&&(e=(7&o)<<18|a()<<12|a()<<6|a())>=65536&&e<=1114111)return e;throw Error("Invalid UTF-8 detected")}return{version:"3.0.0",encode:function(r){for(var n=e(r),t=n.length,o=-1,i="";++o65535&&(i+=o((n-=65536)>>>10&1023|55296),n=56320|1023&n),i+=o(n);return i}(f)}}})(); 25 | // ------------------------------------------------------------ 26 | const Pathname = /^(?:https?:\/\/)?[^\/]+(\/[^?#]*)?/.exec($request.url)?.[1]; 27 | const Status = $response.status ?? $response.statusCode; 28 | if (Status !== 200) { 29 | console.log("非 200 状态码‼️ ‼️" + Status); 30 | $done({}); 31 | } 32 | const EncryptionOrNot = 33 | `${$response.headers["reqentryption"] ?? $response.headers["reqEntryption"]}`.toLowerCase() === 34 | "base64"; 35 | // ------------------------------------------------------------ 36 | const Home_Category_Selection = [ 37 | // "mainBusiness", // 金刚位 - 菜单 38 | "rankAlgorithm", // 榜单 39 | "newReport", // 近期新书 40 | "editorRecommend", // 编辑推荐 41 | "book", // 讲书 42 | "singleBookList", // 书单 43 | "course" // 课程 44 | ]; 45 | const Book_Category_Selection = [ 46 | "newBooks", // 本周新书 47 | "studyHistory", // 最近在学 48 | "recommendBookList", // 书单推荐 49 | "speakers", // 主讲人 50 | "recommendBook", // 专属推荐 51 | "algorithmRecom" // 算法推荐 52 | ]; 53 | const User_Setting_Selection = [ 54 | // "227", // 帆书企业版 - 展示[企业版] 55 | // "141", // 邀请好友页(邀请有礼) - 展示[邀请有礼] 56 | // "148", // 组队读书 - 展示[组队读书] 57 | // "153", // web页面 - 展示[职业福利] 58 | // "216", // 我的-更多服务页面 - 展示[更多服务] 59 | // "228" // 签到任务中心页 - 展示[大学生福利] 60 | ]; 61 | // ------------------------------------------------------------ 62 | let Decode_Body = jsonParse( 63 | EncryptionOrNot ? utf8.decode(base64.decode($response.body)) : $response.body, 64 | null 65 | ); 66 | if (Decode_Body === null) { 67 | console.log("响应体解析失败‼️" + $response.body); 68 | $done({}); 69 | } 70 | // ------------------------------------------------------------ 71 | // console.log(jsonStr(Decode_Body, null, 2)); 72 | // 课程菜单优化 73 | if (Pathname.includes("/chief-orch/home/bookPortal/v105/category")) { 74 | const headCategories = Decode_Body.data.headCategories; 75 | Decode_Body.data.headCategories = headCategories.filter((item) => { 76 | return item.code !== "web"; 77 | }); 78 | } 79 | // 各页面banner 80 | if (Pathname.includes("/abtest-front/banner-modular/get")) { 81 | if (Decode_Body?.data?.banners?.length) { 82 | console.log( 83 | `[Banner] - [${Decode_Body.data?.moduleCode}] - [${Decode_Body.data?.planName}] - 移除` 84 | ); 85 | Decode_Body.data.banners = []; 86 | } 87 | } 88 | // 听书首页优化 89 | if (Pathname.includes("/resource-orchestration-system/book/channel/v100/info")) { 90 | Decode_Body.data.moduleList.forEach((item) => { 91 | if (Book_Category_Selection.includes(item.moduleCode)) { 92 | console.log(`${item.moduleCode} - [${item.moduleName}] - 保留`); 93 | item.showFlag = true; 94 | } else { 95 | console.log(`${item.moduleCode} - [${item.moduleName}] - 移除`); 96 | item.showFlag = false; 97 | } 98 | }); 99 | } 100 | // 个人信息页优化 101 | if (Pathname.includes("/fs-member/user/profile/v100/detail")) { 102 | Decode_Body.data.vipInfos = []; 103 | } 104 | // 首页优化 105 | if (Pathname.includes("/chief-orch/home/bookPortal/v111/forApp")) { 106 | const modules = Decode_Body.data.modules; 107 | Decode_Body.data.modules = modules.filter((item) => { 108 | return Home_Category_Selection.includes(item.moduleCode); 109 | }); 110 | } 111 | // 个人设置项优化 112 | if (Pathname.includes("/sns-orchestration-system/homePage/api/v100/myPage")) { 113 | Decode_Body.data.vipConfig.vipConfigs = []; 114 | Decode_Body.data.serviceCenter.services = Decode_Body.data.serviceCenter?.services?.filter( 115 | (item) => { 116 | return User_Setting_Selection.includes(item.linkId); 117 | } 118 | ); 119 | } 120 | // 会员任务去除 121 | if (Pathname.includes("/task-orchestration/taskCenter/api/v101/taskList")) { 122 | Decode_Body.data.taskInfoList = []; 123 | } 124 | // 听书页优化 125 | if (Pathname.includes("/resource-orchestration-system/book/v101/content")) { 126 | if (Decode_Body.data?.bookComponent) { 127 | for (const item of Decode_Body.data.bookComponent) { 128 | if (item.hasOwnProperty("compBanner")) { 129 | delete item.compBanner; 130 | } 131 | } 132 | } 133 | } 134 | // 听书页下方横幅 135 | if (Pathname.includes("/user-orchestration/user/api/v101/ceiltip")) { 136 | Decode_Body.data = true; 137 | } 138 | // ------------------------------------------------------------ 139 | $done({ 140 | body: EncryptionOrNot ? base64.encode(utf8.encode(jsonStr(Decode_Body))) : jsonStr(Decode_Body) 141 | }); 142 | 143 | function jsonParse(json, defaultValue) { 144 | try { 145 | return JSON.parse(`${json}`); 146 | } catch { 147 | return defaultValue ?? json; 148 | } 149 | } 150 | function jsonStr(json, ...args) { 151 | if (typeof json === "string") return json; 152 | try { 153 | return JSON.stringify(json, ...args); 154 | } catch { 155 | return json; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /Scripts/FanShu/fanshu.plugin: -------------------------------------------------------------------------------- 1 | #!name=帆书(樊登读书) 2 | #!desc=全局净化 3 | #!author=𝐎𝐍𝐙𝟑𝐕 4 | #!icon=https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/f4/4b/c1/f44bc1dd-a403-b865-547a-e1e967faabb3/AppIcon-1x_U007epad-0-0-85-220-0.png/144x144.png 5 | #!keyword=广告必须噶 6 | #!openUrl=https://apps.apple.com/app/id963152777 7 | #!homepage=https://github.com/Yuheng0101/X 8 | 9 | [Rewrite] 10 | # 帆书移除广告 11 | ^https?:\/\/popup\.dushu365\.com\/api\/v2\/sfo\/(user_)?popup_(config|display)s - reject 12 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/config\/config\/v\d+\/(shortCut|appUpdateUnite|loadingAd) - reject 13 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fs-retain\/trialVip\/v\d+\/requestTrialVipPopDoNotSendReward - reject 14 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/vipLandingPage\/v\d+\/getVipLandingPageApp - reject 15 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fandeng-orch\/dual2211\/config - reject 16 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fdtalk-orch\/newcomerzone\/v\d+\/guide - reject 17 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fandeng-orch\/bookboy\/v\d+\/vipPagePop - reject 18 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/config\/config\/v\d+\/appConfig - reject 19 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/order-orchestration\/orderWeb\/exchange\/v100\/showExchangeButton - reject 20 | 21 | [Script] 22 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/home\/bookPortal\/v105\/category script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 23 | 24 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/abtest-front\/banner-modular\/get script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 25 | 26 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/book\/channel\/v100\/info script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 27 | 28 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fs-member\/user\/profile\/v100\/detail script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 29 | 30 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/home\/bookPortal\/v111\/forApp script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 31 | 32 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/sns-orchestration-system\/homePage\/api\/v100\/myPage script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 33 | 34 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/task-orchestration\/taskCenter\/api\/v101\/taskList script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 35 | 36 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/book\/v101\/content script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 37 | 38 | http-response ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/user-orchestration\/user\/api\/v101\/ceiltip script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=true, timeout=60, tag=Fanshu_Remove_Ads 39 | 40 | [MITM] 41 | hostname = g*.dushu365.com 42 | 43 | -------------------------------------------------------------------------------- /Scripts/FanShu/fanshu.sgmodule: -------------------------------------------------------------------------------- 1 | #!name= 帆书 2 | #!desc= 全局净化 3 | #!category= 广告必须噶 4 | 5 | [Map Local] 6 | # 帆书移除广告 7 | ^https?:\/\/popup\.dushu365\.com\/api\/v2\/sfo\/(user_)?popup_(config|display)s - reject 8 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/config\/config\/v\d+\/(shortCut|appUpdateUnite|loadingAd) - reject 9 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fs-retain\/trialVip\/v\d+\/requestTrialVipPopDoNotSendReward - reject 10 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/vipLandingPage\/v\d+\/getVipLandingPageApp - reject 11 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fandeng-orch\/dual2211\/config - reject 12 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fdtalk-orch\/newcomerzone\/v\d+\/guide - reject 13 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fandeng-orch\/bookboy\/v\d+\/vipPagePop - reject 14 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/config\/config\/v\d+\/appConfig - reject 15 | ^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/order-orchestration\/orderWeb\/exchange\/v100\/showExchangeButton - reject 16 | 17 | [Script] 18 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/home\/bookPortal\/v105\/category, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 19 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/abtest-front\/banner-modular\/get, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 20 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/book\/channel\/v100\/info, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 21 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/fs-member\/user\/profile\/v100\/detail, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 22 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/chief-orch\/home\/bookPortal\/v111\/forApp, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 23 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/sns-orchestration-system\/homePage\/api\/v100\/myPage, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 24 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/task-orchestration\/taskCenter\/api\/v101\/taskList, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 25 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/resource-orchestration-system\/book\/v101\/content, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 26 | Fanshu_Remove_Ads = type=http-response, pattern=^https?:\/\/g[a-z0-9-]+\.dushu365\.com\/user-orchestration\/user\/api\/v101\/ceiltip, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/FanShu/No_Ads.js, requires-body=1, max-size=-1, timeout=60 27 | 28 | 29 | [MITM] 30 | hostname = %APPEND% g*.dushu365.com 31 | 32 | -------------------------------------------------------------------------------- /Scripts/HeiLiao/web.js: -------------------------------------------------------------------------------- 1 | let body = $response.body; 2 | 3 | if (/<\/head>/.test(body)) { 4 | body = body.replace(/<\/head>/, ""); 5 | $done({ body }); 6 | } 7 | 8 | $done({}); 9 | -------------------------------------------------------------------------------- /Scripts/KanLiXiang/No_Ads.js: -------------------------------------------------------------------------------- 1 | const Pathname = /^(?:https?:\/\/)?[^\/]+(\/[^?#]*)?/.exec($request.url)?.[1]; 2 | console.log(Pathname); 3 | const Status = $response.status ?? $request.statusCode; 4 | if (Status !== 200) { 5 | console.log("非 200 状态码‼️ ‼️" + Status); 6 | $done({}); 7 | } 8 | if ($request.method.toUpperCase() === "OPTIONS") { 9 | $done({}); 10 | } 11 | let body = jsonParse($response.body, null); 12 | if (body === null) { 13 | console.log("响应体解析失败‼️" + $response.body); 14 | $done({}); 15 | } 16 | if (body?.status !== "success") { 17 | console.log("响应出错‼️" + body?.data || body); 18 | $done({}); 19 | } 20 | 21 | // 配置优化 22 | if (/v2\/other\/config/i.test(Pathname)) { 23 | body.data.dialog = null; 24 | body.data.advertisements = []; 25 | body.data.friend_config.my_buy_image = `http://cdn.vistopia.com.cn/1582885400613.png`; 26 | body.data.vip_config.my_buy_image = `http://cdn.vistopia.com.cn/1651368454378.png`; 27 | body.data.vip_config.black_my_buy_image = `http://cdn.vistopia.com.cn/1651368454378.png`; 28 | for (const key in body.data.app_config) { 29 | if (key.endsWith("_is_show")) { 30 | body.data.app_config[key] = "0"; 31 | } 32 | } 33 | } 34 | 35 | // 首页自定义 36 | if (/v2\/home\/header-new/i.test(Pathname)) { 37 | const Black_Type_List = [ 38 | "home_sliders", // 首页轮播图 39 | // "home_nav", // 首页分类图标 40 | // "home_today", // 观念日历 41 | "card_image" // 外链卡片 42 | // "home_hots", // 今日榜单 43 | // "topic_broadcast", // 清明上河图 44 | // "home_content_update", // 最近更新 45 | // "listener_discuss", // 听众讨论 46 | // "lead_read", // 资深评论 47 | // "card_single_content", // 节目上新 48 | // "card_single_article", // 今日限免 49 | // "home_gold", // 每日金句 50 | // "card_album", // 合辑推荐 51 | // "home_page_recommend" // 专题推荐 52 | ]; 53 | console.log("拉黑模块[" + Black_Type_List.join(",") + "]"); 54 | body.data = body.data.filter((item) => { 55 | return !Black_Type_List.includes(item.type); 56 | }); 57 | if (!Black_Type_List.includes("home_nav")) { 58 | const index = body.data.findIndex((item) => item.type === "home_nav"); 59 | body.data[index].data.forEach((item) => { 60 | item.tips_url = ""; 61 | }); 62 | } 63 | if (!Black_Type_List.includes("card_single_content")) { 64 | const index = body.data.findIndex((item) => item.type === "card_single_content"); 65 | body.data[index].data.forEach((item) => { 66 | // item.sale_price = ""; 67 | item.label = "vip_free_y"; 68 | }); 69 | } 70 | } 71 | 72 | // 会员页假解锁 73 | if (/vip\/buy-list/i.test(Pathname)) { 74 | body.data.is_vip_expire = "0"; 75 | body.data.module_list = []; 76 | body.data.equity_list = []; 77 | const trial_index = body.data.goods_equity.findIndex((item) => item.title === "畅听卡"); 78 | body.data.goods_equity[trial_index].buy_btn.bottom_text = 79 | "畅听卡永久有效"; 80 | body.data.vip_data = { 81 | expire_time: "2099-12-31", 82 | vip_left_days: "999", 83 | vip_type: "lixiangjia_trial", 84 | h5_gift_url: "", 85 | buy_text: "立即开通", 86 | link_url: "", 87 | equity_intro: { 88 | title: "我的会员权益", 89 | link_url: 90 | "https://shop.vistopia.com.cn/idealist_rights_info?equity_type=TCTK0011&hide_bar=1" 91 | }, 92 | vip_valide: "畅听卡会员永久有效", 93 | expire_list: [ 94 | { 95 | title: "畅听卡会员", 96 | content: "永久有效" 97 | } 98 | ] 99 | }; 100 | } 101 | // 列表假解锁 102 | if (/(class\/content|content\/sales-list)/i.test(Pathname)) { 103 | body.data?.data?.forEach((item) => { 104 | item.vip_type = "lixiangjia_trial"; 105 | }); 106 | } 107 | 108 | // 个人中心假解锁会员 109 | if (/v2\/user\/profile/i.test(Pathname)) { 110 | body.data.vip_type = "lixiangjia_trial"; 111 | body.data.user_file.equity_txt = "畅听卡会员永久有效"; 112 | body.data.user_file.vip_type = "lixiangjia_trial"; 113 | body.data.user_file.vip_expire_date = "2099-12-31"; 114 | body.data.user_file.vip_left_days = "999"; 115 | body.data.user_file.is_show_equity = "1"; 116 | body.data.user_file.is_vip_expire = "0"; 117 | if (body.data.user_file?.old_vip_type) { 118 | body.data.user_file.old_vip_type = ""; 119 | } 120 | } 121 | 122 | // 文学的记忆 123 | if (/broadcast\/show/i.test(Pathname)) { 124 | body.data?.articles?.forEach((item) => { 125 | item.is_listen = "1"; 126 | }); 127 | } 128 | 129 | // 主讲人 130 | if (/author\/author-show/i.test(Pathname)) { 131 | body.data?.contents?.forEach((item) => { 132 | item.vip_type = "lixiangjia_trial"; 133 | }); 134 | } 135 | 136 | // 文章列表 137 | if (/content\/article_list/i.test(Pathname)) { 138 | body.data?.article_list?.forEach((item) => { 139 | item.vip_type = "lixiangjia_trial"; 140 | }); 141 | } 142 | 143 | // 文章详情 144 | if (/content\/content-show\/\d+/i.test(Pathname)) { 145 | body.data.is_purchased = "1"; 146 | } 147 | 148 | $done({ body: jsonStr(body) }); 149 | 150 | function jsonParse(json, defaultValue) { 151 | try { 152 | return JSON.parse(`${json}`); 153 | } catch { 154 | return defaultValue || json; 155 | } 156 | } 157 | function jsonStr(json, ...args) { 158 | if (typeof json === "string") return json; 159 | try { 160 | return JSON.stringify(json, ...args); 161 | } catch { 162 | return json; 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /Scripts/KanLiXiang/klx.sgmodule: -------------------------------------------------------------------------------- 1 | #!name= 看理想 2 | #!desc= 全局净化、畅听卡假解锁 3 | #!author= 𝐎𝐍𝐙𝟑𝐕 4 | #!category= 广告必须噶 5 | #!keyword=广告必须噶 6 | #!icon=https://is1-ssl.mzstatic.com/image/thumb/Purple211/v4/78/87/c5/7887c5d8-ae49-a187-e7ae-ca9361a5d7f9/AppIcon-0-0-1x_U007epad-0-9-0-85-220.png/144x144.png 7 | #!openUrl=https://apps.apple.com/app/id1342118033 8 | #!homepage=https://github.com/Yuheng0101/X 9 | 10 | [Map Local] 11 | # 看理想去开屏 12 | ^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/home\/advertisement data-type=text data=" " status-code=200 13 | ^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/other\/pop-up data-type=text data=" " status-code=200 14 | 15 | [Script] 16 | KanLiXiang_No_Ads = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/other\/config, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 17 | KanLiXiang_No_Ads = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/home\/header-new, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 18 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/user\/profile, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 19 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/vip\/buy-list, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 20 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/class\/content, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 21 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/content\/sales-list, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 22 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/broadcast\/show, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 23 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/author\/author-show, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 24 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/content\/article_list, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 25 | KanLiXiang_Faker_Unlock = type=http-response, pattern=^https?:\/\/api\.vistopia\.com\.cn\/api\/v\d\/content\/content-show\/\d+, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/KanLiXiang/No_Ads.js, requires-body=1, max-size=-1, timeout=5 26 | 27 | [MITM] 28 | hostname = %APPEND% api.vistopia.com.cn 29 | 30 | 31 | -------------------------------------------------------------------------------- /Scripts/NeteaseCloudMusic/netease.plugin: -------------------------------------------------------------------------------- 1 | #!name=网易云音乐 2 | #!desc=解锁会员音频、音质 3 | #!icon=https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/d3/77/da/d377dac9-b69e-5b7c-e7cb-b761f96decec/AppIcon-1x_U007emarketing-0-6-0-0-85-220-0.png/144x144.png 4 | #!homepage= https://github.com/Yuheng0101/X/tree/main/Scripts/NeteaseCloudMusic 5 | #!date=2024-11-21 20:30:00 6 | 7 | [Rewrite] 8 | ^https?:\/\/(?:ipv4|interface\d?)\.music\.163\.com\/e?api\/(mine\/(collect|rn)\/header\/info|v\d\/user\/detail\/\d+|vipnewcenter\/app\/resource\/newaccountpage|music-vip-membership\/(client|front)\/vip\/info|batch|playlist\/privilege|search\/complex\/page|v\d\/(discovery\/recommend\/songs|playlist\/detail)) header-replace x-aeapi false 9 | ^https?:\/\/interface\d?\.music\.163\.com\/e?api\/vip\/cashier\/tspopup\/get - reject-200 10 | 11 | [Script] 12 | http-response ^https?:\/\/interface\d?\.music\.163\.com\/e?api\/(mine\/(collect|rn)\/header\/info|v\d\/user\/detail\/\d+|vipnewcenter\/app\/resource\/newaccountpage|music-vip-membership\/(client|front)\/vip\/info|batch|playlist\/privilege|search\/complex\/page|v\d\/(discovery\/recommend\/songs|playlist\/detail)) script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/NeteaseCloudMusic/netease.js, requires-body=true, binary-body-mode=true, timeout=60, tag=网易云重写 13 | 14 | http-request ^https?:\/\/interface\d?\.music\.163\.com\/e?api\/(song\/enhance\/player\/url\/v\d|vipauth\/app\/auth\/query) script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/NeteaseCloudMusic/netease.js, requires-body=true, timeout=60, tag=网易云转发 15 | 16 | [MITM] 17 | hostname = interface*.music.163.com -------------------------------------------------------------------------------- /Scripts/NeteaseCloudMusic/netease.sgmodule: -------------------------------------------------------------------------------- 1 | #!name=网易云音乐 2 | #!desc=解锁会员音频、音质 3 | #!system=ios 4 | #!icon=https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/d3/77/da/d377dac9-b69e-5b7c-e7cb-b761f96decec/AppIcon-1x_U007emarketing-0-6-0-0-85-220-0.png/144x144.png 5 | #!date=2024-11-21 20:30:00 6 | 7 | [Header Rewrite] 8 | http-request ^https?:\/\/(?:ipv4|interface\d?)\.music\.163\.com\/e?api\/(mine\/(collect|rn)\/header\/info|v\d\/user\/detail\/\d+|vipnewcenter\/app\/resource\/newaccountpage|music-vip-membership\/(client|front)\/vip\/info|batch|playlist\/privilege|search\/complex\/page|v\d\/(discovery\/recommend\/songs|playlist\/detail)) header-del x-aeapi 9 | 10 | [Map Local] 11 | ^https?:\/\/interface\d?\.music\.163\.com\/e?api\/vip\/cashier\/tspopup\/get data-type=text data=" " status-code=200 12 | 13 | [Script] 14 | 网易云重写 = type=http-response, pattern=^https?:\/\/interface\d?\.music\.163\.com\/e?api\/(mine\/(collect|rn)\/header\/info|v\d\/user\/detail\/\d+|vipnewcenter\/app\/resource\/newaccountpage|music-vip-membership\/(client|front)\/vip\/info|batch|playlist\/privilege|search\/complex\/page|v\d\/(discovery\/recommend\/songs|playlist\/detail)), script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/NeteaseCloudMusic/netease.js, requires-body=true, binary-body-mode=1, max-size=-1, timeout=60 15 | 16 | 网易云转发 = type=http-request, pattern=^https?:\/\/interface\d?\.music\.163\.com\/e?api\/(song\/enhance\/player\/url\/v\d|vipauth\/app\/auth\/query), script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/NeteaseCloudMusic/netease.js, requires-body=true, max-size=-1, timeout=60 17 | 18 | [MITM] 19 | hostname = %APPEND% interface*.music.163.com 20 | -------------------------------------------------------------------------------- /Scripts/jdck-ql.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 获取京东 COOKIE 同步青龙 3 | * @channel https://t.me/yqc_123 4 | * @feedback https://t.me/yqc_777 5 | * @version 1.0.1 6 | ****************************************** 7 | # 获取京东 COOKIE 同步青龙 8 | 9 | ## 脚本注明 10 | 11 | 1. 本脚本仅供学习交流,禁止用于商业用途,违者后果自负。 12 | 2. 转载脚本请注明来源,欢迎分享,拒绝倒卖,倒卖🐕必死🐎。 13 | 3. 欢迎对本仓库(https://github.com/Yuheng0101/X)Star✅,但请不要Fork❌。 14 | 15 | ## 使用方式 16 | 17 | > 使用该脚本前务必需要在 👉 [Boxjs](https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/boxjs.json)👈 中配置青龙面板的相关参数。 18 | 19 | > 由于该脚本使用 [NobyDa 大佬的京东签到脚本](https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js)获取 CK 的方式进行抓取并同步到青龙面板,所以跟签到脚本不冲突,使用同一组缓存变量。 20 | 21 | > Safari 浏览器登录 https://home.m.jd.com/myJd/newhome.action 点击个人中心页面后, 打开app抓包, 提示成功后即可关闭。 22 | 23 | ## 致谢 24 | 25 | [@NobyDa](https://github.com/NobyDa) 26 | 27 | [@Peng-YM](https://github.com/Peng-YM) 28 | 29 | [@chavyleung](https://github.com/chavyleung) 30 | ****************************************** 31 | 32 | ^https:\/\/(api\.m|me-api)\.jd\.com\/api\?functionId=GetJDUserInfoUnionForJD url script-request-header https://raw.githubusercontent.com/Yuheng0101/X/main/Scripts/jdck-ql.js 33 | 34 | hostname = me-api.jd.com, api.m.jd.com 35 | 36 | ******************************************/ 37 | const $ = new Env('京东COOKIE同步青龙') 38 | const isRequest = typeof $request !== 'undefined' 39 | $.isNode() && require('dotenv').config() 40 | let QL_HOST = $.isNode() ? process.env.QL_HOST : $.getdata('yuheng_ql_host') || '' 41 | let QL_CLIENT_ID = $.isNode() ? process.env.QL_CLIENT_ID : $.getdata('yuheng_ql_clientid') || '' 42 | let QL_CLIENT_SECRET = $.isNode() ? process.env.QL_CLIENT_SECRET : $.getdata('yuheng_ql_clientsecret') || '' 43 | let isSync = QL_HOST && QL_CLIENT_ID && QL_CLIENT_SECRET 44 | !(async () => { 45 | isSync && (ql = new QingLong(QL_HOST, QL_CLIENT_ID, QL_CLIENT_SECRET)) 46 | if (isRequest) { 47 | await GetCookie() 48 | return 49 | } 50 | // ... 51 | })() 52 | .catch((e) => $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')) 53 | .finally(() => $.done()) 54 | 55 | // https://github.com/NobyDa/Script/blob/master/JD-DailyBonus/JD_DailyBonus.js#L1582 56 | function checkFormat(value) { 57 | //check format and delete duplicates 58 | let n, 59 | k, 60 | c = {} 61 | return value.reduce((t, i) => { 62 | k = ((i.cookie || '').match(/(pt_key|pt_pin)=.+?;/g) || []).sort() 63 | if (k.length == 2) { 64 | if ((n = k[1]) && !c[n]) { 65 | i.userName = i.userName ? i.userName : decodeURIComponent(n.split(/pt_pin=(.+?);/)[1]) 66 | i.cookie = k.join('') 67 | if (i.jrBody && !i.jrBody.includes('reqData=')) { 68 | console.log(`异常钢镚Body已过滤: ${i.jrBody}`) 69 | delete i.jrBody 70 | } 71 | c[n] = t.push(i) 72 | } 73 | } else { 74 | console.log(`异常京东Cookie已过滤: ${i.cookie}`) 75 | } 76 | return t 77 | }, []) 78 | } 79 | function CookieUpdate(oldValue, newValue, path = 'cookie') { 80 | let item, 81 | type, 82 | name = (oldValue || newValue || '').split(/pt_pin=(.+?);/)[1] 83 | let total = $.getdata('CookiesJD') 84 | try { 85 | total = checkFormat(JSON.parse(total || '[]')) 86 | } catch (e) { 87 | $.msg('京东签到', '', 'Cookie JSON格式不正确, 即将清空\n可前往日志查看该数据内容!') 88 | console.log(`京东签到Cookie JSON格式异常: ${e.message || e}\n旧数据内容: ${total}`) 89 | total = [] 90 | } 91 | for (let i = 0; i < total.length; i++) { 92 | if (total[i].cookie && new RegExp(`pt_pin=${name};`).test(total[i].cookie)) { 93 | item = i 94 | break 95 | } 96 | } 97 | if (newValue && item !== undefined) { 98 | type = total[item][path] === newValue ? -1 : 2 99 | total[item][path] = newValue 100 | item = item + 1 101 | } else if (newValue && path === 'cookie') { 102 | total.push({ 103 | cookie: newValue 104 | }) 105 | type = 1 106 | item = total.length 107 | } 108 | return { 109 | total: checkFormat(total), 110 | type, //-1: same, 1: add, 2:update 111 | item, 112 | name: decodeURIComponent(name) 113 | } 114 | } 115 | async function GetCookie() { 116 | let req = !!$request ? $request : {} 117 | let Message = '' 118 | if (req.method != 'OPTIONS' && req.headers) { 119 | const CV = req.headers['Cookie'] || req.headers['cookie'] || '' 120 | const ckItems = CV.match(/(pt_key|pt_pin)=.+?;/g) 121 | if (/^https:\/\/(me-|)api(\.m|)\.jd\.com\/api/.test(req.url)) { 122 | if (ckItems && ckItems.length == 2) { 123 | const value = CookieUpdate(null, ckItems.join('')) 124 | if (value.type !== -1) { 125 | const write = $.setdata(JSON.stringify(value.total, null, 2), 'CookiesJD') 126 | Message += `${value.type == 2 ? `更新` : `写入`}京东 [账号${value.item}] Cookie${write ? `成功 🎉` : `失败 ‼️`}` 127 | await $.msg(`用户名: ${value.name}`, ``, Message) 128 | } else { 129 | console.log(`\n用户名: ${value.name}\n与历史京东 [账号${value.item}] Cookie相同, 跳过写入 ⚠️`) 130 | } 131 | if (isSync) { 132 | // 处理逻辑放到外层 133 | const ql = new QingLong(QL_HOST, QL_CLIENT_ID, QL_CLIENT_SECRET) 134 | let opts = { 135 | name: 'JD_COOKIE', 136 | value: `${ckItems.join('')}`, 137 | remarks: value.name 138 | } 139 | await ql.checkLogin() 140 | ql.envs.length === 0 && (await ql.getEnvs()) 141 | const pinReg = /pin=(.+?);/ 142 | const keyReg = /pt_key=(.+?);/ 143 | const _pin = ql.checkEnvByValue(opts.value, pinReg) 144 | const _key = ql.checkEnvByValue(opts.value, keyReg) 145 | try { 146 | // PIN匹配不到 -> 添加 147 | if (_pin === -1) { 148 | opts = [opts] 149 | console.log(`\n用户名: ${value.name}\n同步青龙参数: ${JSON.stringify(opts)}`) 150 | await ql.addEnv(opts) 151 | $.msg(`用户名: ${value.name}`, ``, `青龙添加成功 🎉`) 152 | // KEY不同 -> 更新 153 | } else if (_key === -1) { 154 | delete opts.remarks 155 | Object.assign(opts, { 156 | _id: ql.envs[_pin]._id 157 | }) 158 | console.log(`\n用户名: ${value.name}\n同步青龙参数: ${JSON.stringify(opts)}`) 159 | await ql.updateEnv(opts) 160 | $.msg(`用户名: ${value.name}`, ``, `青龙更新成功 🎉`) 161 | // KEY相同 -> 跳过 162 | } else { 163 | console.log(`\n用户名: ${value.name}\n与历史青龙 [账号${_key + 1}] Cookie相同, 跳过写入 ⚠️`) 164 | } 165 | } catch (e) { 166 | console.log(e) 167 | } 168 | } 169 | } else { 170 | throw new Error('写入Cookie失败, 关键值缺失\n可能原因: 非网页获取 ‼️') 171 | } 172 | } else if (req.url === 'http://www.apple.com/') { 173 | throw new Error('类型错误, 手动运行请选择上下文环境为Cron ⚠️') 174 | } 175 | } else if (!req.headers) { 176 | throw new Error('写入Cookie失败, 请检查匹配URL或配置内脚本类型 ⚠️') 177 | } 178 | } 179 | // prettier-ignore 180 | function QingLong(t,e,n){const o=(t,e="GET")=>{if($.isNode()&&t.hasOwnProperty("use_proxy")&&t.use_proxy){require("dotenv").config();const e=process.env.PROXY_HOST||"127.0.0.1",n=process.env.PROXY_PORT||7890,o=require("tunnel"),s={https:o.httpsOverHttp({proxy:{host:e,port:1*n}})};Object.assign(t,{agent:s})}return new Promise((n,o)=>{$.http[e.toLowerCase()](t).then(t=>{var e=t.body;try{e=JSON.parse(e)}catch(t){}n(e)}).catch(t=>o(t))})};return new class{constructor(t,e,n){this.host=t?t.endsWith("/")?t:t+"/":"",this.clientId=e,this.clientSecret=n,this.token="",this.envs=[]}async checkLogin(){let t;try{t=JSON.parse($.getdata("yuheng_ql_token")||"{}")}catch(t){return console.log("❌The token is invalid, please re-enter the token"),await this.getAuthToken(),!1}if(Object.keys(t).length>0){const{token:e,expiration:n}=t,o=(new Date).getTime();o>n?($.log("❌The token has expired"),await this.getAuthToken()):(this.token=e,$.log(`✅The token is successfully obtained (${this.token}) from cache and is valid until ${$.time("yyyy-MM-dd HH:mm:ss",n)}`))}else await this.getAuthToken()}async getAuthToken(){const t={url:`${this.host}open/auth/token`,params:{client_id:this.clientId,client_secret:this.clientSecret}};try{console.log(`传入参数: ${JSON.stringify(t)}`);const{code:e,data:n,message:s}=await o(t);if(200!==e)throw s||"Failed to obtain user token.";{const{token:t,token_type:e,expiration:o}=n;$.log(`✅The token is successfully obtained: ${t} and is valid until ${$.time("yyyy-MM-dd HH:mm:ss",1e3*o)}`),this.token=`${e} ${t}`,$.setdata(JSON.stringify({token:this.token,expiration:1e3*o}),"yuheng_ql_token")}}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}async getEnvs(){const t={url:`${this.host}open/envs`,headers:{Authorization:`${this.token}`}};try{const{code:e,data:n,message:s}=await o(t);if(200!==e)throw s||"Failed to obtain the environment variable.";this.envs=n,$.log("✅Obtaining environment variables succeeded.")}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}checkEnvByName(t){return this.envs.findIndex(e=>e.name===t)}checkEnvByRemarks(t){return this.envs.findIndex(e=>e.remarks===t)}checkEnvByValue(t,e){const n=t.match(e);if(n){const e=this.envs.findIndex(t=>t.value.includes(n[0]));return e>-1?($.log(`🆗${t} Matched: ${n[0]}`),e):($.log(`⭕${t} No Matched`),-1)}return $.log(`⭕${t} No Matched`),-1}async addEnv(t){const e={url:`${this.host}open/envs`,headers:{Authorization:`${this.token}`,"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(t)};try{const{code:t,message:n}=await o(e,"post");if(200!==t)throw n||"Failed to add the environment variable.";$.log("✅The environment variable was added successfully.")}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}async updateEnv(t){const e={url:`${this.host}open/envs`,method:"put",headers:{Authorization:`${this.token}`,"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(t)};try{const{code:n,message:s}=await o(e,"post");if(200!==n)throw s||"Failed to update the environment variable.";$.log("✅The environment variable was updated successfully."),await this.enableEnv([t._id])}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}async deleteEnv(t){const e={url:`${this.host}open/envs`,method:"delete",headers:{Authorization:`${this.token}`,"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(t)};try{const{code:t,message:n}=await o(e,"post");if(200!==t)throw n||"Failed to delete the environment variable.";$.log("✅The environment variable was deleted successfully.")}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}async enableEnv(t){const e={url:`${this.host}open/envs/enable`,method:"put",headers:{Authorization:`${this.token}`,"Content-Type":"application/json;charset=UTF-8"},body:JSON.stringify(t)};try{const{code:t,message:n}=await o(e,"post");if(200!==t)throw n||"Failed to enable the environment variable.";$.log("✅The environment variable was enabled successfully.")}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}async getEnvById(t){const e={url:`${this.host}open/envs/${t}`,headers:{Authorization:`${this.token}`}};try{const{code:t,data:n,message:s}=await o(e);if(200===t)return n;throw s||"Failed to get the environment variable."}catch(t){throw t?"object"==typeof t?JSON.stringify(t):t:"Network Error."}}}(t,e,n)} 181 | // prettier-ignore 182 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,a)=>{s.call(this,t,(t,s,r)=>{t?a(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const a=this.getdata(t);if(a)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 183 | -------------------------------------------------------------------------------- /Tasks/1024.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 某榴最新技術推送 3 | * @channel https://t.me/yqc_123 4 | * @feedback https://t.me/yqc_777 5 | * @version 1.0.1 6 | ****************************************** 7 | ## 更新日志 8 | ### 20231020 9 | 1.修复帖子过短问题 10 | 2.强制非文字帖和广告帖 11 | 3.可从BoxJs配置推送帖的方式 12 | 13 | ## 脚本声明 14 | 1.此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 15 | 2.由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 16 | 3.请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。 17 | 4.此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 18 | 5.本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 19 | 6.如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 20 | 7.所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明, 本人保留随时更改或补充此声明的权利, 一旦您使用或复制了此脚本,即视为您已接受此免责声明。 21 | 22 | ## 使用方法 23 | 24 | ### 配置 (QuanX) 25 | ```properties 26 | [task_local] 27 | 0 8,14,20 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/1024.js, tag=最新技術推送, img-url=https://raw.githubusercontent.com/Yuheng0101/X/main/Assets/1024.png, enabled=true 28 | ``` 29 | ### 配置 (Loon) 30 | ```properties 31 | [Script] 32 | cron "0 8,14,20 * * *" script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/1024.js, timeout=10, tag=最新技術推送, img-url=https://raw.githubusercontent.com/Yuheng0101/X/main/Assets/1024.png 33 | ``` 34 | ### 配置 (Surge) 35 | ```properties 36 | 最新技術推送 = type=cron,cronexp= 0 8,14,20 * * *,wake-system=1,script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/1024.js,timeout=60 37 | ``` 38 | ## BoxJs地址 39 | https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/boxjs.json 40 | ******************************************/ 41 | let scriptName = '草榴技術討論區', 42 | $ = new Env(scriptName), 43 | baseURL = 'https://t66y.com/', 44 | isRandom = $.getdata('1024_israndom') || false 45 | !(async () => { 46 | const postList = await getPosts() 47 | var { post, postContent } = await findValidPost(postList) 48 | $.msg( 49 | `🔔${scriptName}`, 50 | `《${post.title}》\n【发布时间】\n${$.time('yyyy-MM-dd HH:mm:ss', post.date)}`, 51 | postContent, 52 | { 'open-url': post.href } 53 | ) 54 | })() 55 | .catch((e) => $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')) 56 | .finally(() => $.done()) 57 | async function findValidPost(postList) { 58 | try { 59 | const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min) 60 | let randomIdx = random(0, postList.length - 1) 61 | let post = isRandom.toString() === 'false' ? postList[0] : postList[randomIdx] 62 | let postContent = '' 63 | while (postContent.length < 100) { 64 | randomIdx = random(0, randomIdx + 1) 65 | post = postList[randomIdx] 66 | postContent = await getPostContent(post) 67 | } 68 | return { post, postContent } 69 | } catch (e) { 70 | throw e 71 | } 72 | } 73 | function getPosts() { 74 | const url = baseURL + 'thread0806.php?fid=7&search=today' 75 | return new Promise(async (resolve, reject) => { 76 | const html = await Request({ url, method: 'get', use_proxy: true }) 77 | try { 78 | var posts = html 79 | .replace(/\n|\s|\r/g, '') 80 | .match(/(.*?)<\/tbody>/g)[0] 81 | .match(/(.*?)<\/tbody>/)[1] 82 | .match(/(.*?)<\/tr>/g) 83 | .map((item) => { 84 | try { 85 | let [, href, title, date] = item.match( 86 | /

(.*?)<\/a><\/h3>.*?data-timestamp=\"(.*?)\"/ 87 | ) 88 | title = title.replace(/<.*?>/g, '') 89 | date = Number(date.slice(-1)) ? date : date.slice(0, -1) 90 | return { href: baseURL + href, title, date: date * 1e3 } 91 | } catch (e) { 92 | return {} 93 | } 94 | }) 95 | .filter((item) => !/[\d+P]/.test(item.title)) 96 | resolve(posts) 97 | } catch (e) { 98 | reject(e || '获取帖子失败') 99 | } 100 | }) 101 | } 102 | function getPostContent(obj) { 103 | let { href, title, date } = obj 104 | $.log('', ` 《${title}》`, '【发布时间】', $.time('yyyy-MM-dd HH:mm:ss', date), '') 105 | return new Promise(async (resolve, reject) => { 106 | const html = await Request({ url: href, method: 'get', use_proxy: true }) 107 | try { 108 | var postContent = html 109 | .replace(/\n|\s|\r/g, '') 110 | .match(/(.*?)<\/td>/)[0] 111 | .match(/(.*?)<\/div>/)[1] 112 | .replace(/

/g, '\n') 113 | .replace(/
/g, '\n') 114 | .replace(/ /g, '') 115 | .replace(/&/g, '&') 116 | .replace(/"/g, '"') 117 | .replace(/</g, '<') 118 | .replace(/>/g, '>') 119 | .replace(/<.*?>/g, '') 120 | resolve(postContent) 121 | } catch (e) { 122 | reject(e || '获取帖子内容失败') 123 | } 124 | }) 125 | } 126 | function Request(options) { 127 | if (!options.method) throw '请求方式未指定' 128 | const method = options.method.toLocaleLowerCase() 129 | if ($.isNode() && options?.use_proxy) { 130 | const tunnel = require('tunnel') 131 | const agent = { 132 | https: tunnel.httpsOverHttp({ 133 | proxy: { 134 | host: '127.0.0.1', 135 | port: 7890 136 | } 137 | }) 138 | } 139 | Object.assign(options, { agent }) 140 | } 141 | return new Promise((resolve, reject) => { 142 | $.http[method](options) 143 | .then((response) => { 144 | resolve(response.body) 145 | }) 146 | .catch((err) => reject(err)) 147 | }) 148 | } 149 | // prettier-ignore 150 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,a)=>{s.call(this,t,(t,s,r)=>{t?a(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const a=this.getdata(t);if(a)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 151 | -------------------------------------------------------------------------------- /Tasks/60s.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 每天60秒读懂世界 3 | * @channel https://t.me/yqc_123 4 | * @feedback https://t.me/yqc_777 5 | * @version 1.6.1 6 | ****************************************** 7 | ## 更新日志 8 | 9 | ### 20250215 10 | 使用git监听 11 | 12 | ### 20250206 13 | c_1715391799055720448 该专栏已不再更新, 转为监听 速阅天下事[98-18-69-57] 14 | 15 | ### 20241213 16 | 使用 `https://www.zhihu.com/column/c_1715391799055720448` 栏目来进行通知 17 | 新增原文/全图选择开关 18 | 19 | ### 20241104 20 | 修复图片源失效的问题 21 | 22 | ### 20240716 23 | 1.重构代码 24 | 2.修改通知变量名(青龙环境请将sendNotify放置于脚本同目录) 25 | 3.增加备用接口 26 | 4.不再使用缓存模块 - cheerio.js [可进行搜索并赋值为空] 27 | 28 | ### 20240512 29 | 1.优化通知 30 | 2.适配新版surge图片通知 31 | 32 | ### 20240312 33 | 34 | 1.优化在Surge上的通知 35 | 2.修复Loon在iOS16上存在媒体不通知的情况 36 | 37 | ### 38 | 39 | 使用补齐版cheerio,感谢 @苍井灰灰 灰佬提供的转换思路。 40 | 41 | ### 20231123 42 | 43 | 增加一条备用地址, 以防止接口挂掉。 44 | 45 | ### 20231121 46 | 47 | 考虑到【微语】几乎展示不出来,提前到副标题。 48 | 49 | ### 20231114 50 | 51 | 1.因知乎原帖作者已不在维护, 只得另辟蹊径, 目前使用的是非官方相关内容, 故同步时间会有所延迟, 建议将定时调到 `9:30` 以后。 52 | 2.适配青龙通知, 自行调整 `sendNotify.js` 的位置。 53 | 54 | ### 20231024 55 | 56 | 1.适配通知, 只展示可可用长度的内容, 点击通知查看详细内容。 57 | 58 | ## 脚本声明 59 | 60 | 1.此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 61 | 2.由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 62 | 3.请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。 63 | 4.此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 64 | 5.本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 65 | 6.如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 66 | 7.所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明, 本人保留随时更改或补充此声明的权利, 一旦您使用或复制了此脚本,即视为您已接受此免责声明。 67 | 68 | ## 使用方法 69 | 70 | ### 配置 (QuanX) 71 | 72 | ```properties 73 | [task_local] 74 | 30 9 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/60s.js, tag=每天60秒读懂世界, img-url=https://raw.githubusercontent.com/Yuheng0101/X/main/Assets/60s.png, enabled=true 75 | ``` 76 | 77 | ### 配置 (Loon) 78 | 79 | ```properties 80 | [Script] 81 | cron "30 9 * * *" script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/60s.js, timeout=10, tag=每天60秒读懂世界, img-url=https://raw.githubusercontent.com/Yuheng0101/X/main/Assets/60s.png 82 | ``` 83 | 84 | ### 配置 (Surge) 85 | 86 | ```properties 87 | 每天60秒读懂世界 = type=cron,cronexp=0 30 9 * * *,wake-system=1,script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/60s.js,timeout=60 88 | ``` 89 | 90 | ### 致谢 91 | 92 | [@vikiboss](https://github.com/vikiboss/60s) 93 | 94 | [@速阅天下事](https://www.zhihu.com/people/98-18-69-57) 95 | 96 | [@二喵带你看世界](https://www.zhihu.com/column/c_1715391799055720448) 97 | 98 | [@virgilClyne](github.com/virgilClyne) 99 | 100 | [@cheerio](https://github.com/cheeriojs/cheerio) 101 | 102 | [@苍井灰灰](https://github.com/wf021325) 103 | 104 | [@每天60秒读懂世界](https://www.zhihu.com/people/mt36501) 105 | 106 | [@小竣博客](https://www.jun.la/60snews) 107 | 108 | [@设计导航](https://www.designnavs.com/60s) 109 | 110 | [@冷筱宇](https://www.789dl.cn/zb.html) 111 | 112 | ******************************************/ 113 | (()=>{"use strict";var e={},t={};function a(s){var o=t[s];if(void 0!==o)return o.exports;var r=t[s]={exports:{}};return e[s](r,r.exports,a),r.exports}a.rv=function(){return"1.1.5"},a.ruid="bundler=rspack@1.1.5";const s=(()=>{const e=Object.keys(globalThis);switch(!0){case e.includes("$task"):return"Quantumult X";case e.includes("$loon"):return"Loon";case e.includes("$rocket"):return"Shadowrocket";case"undefined"!=typeof module:return"Node.js";case e.includes("Egern"):return"Egern";case e.includes("$environment"):return $environment["surge-version"]?"Surge":$environment["stash-version"]?"Stash":void 0;default:return}})();class o{static#e=new Map([]);static#t=[];static#a=new Map([]);static clear=()=>{};static count=(e="default")=>{switch(o.#e.has(e)){case!0:o.#e.set(e,o.#e.get(e)+1);break;case!1:o.#e.set(e,0)}o.log(`${e}: ${o.#e.get(e)}`)};static countReset=(e="default")=>{switch(o.#e.has(e)){case!0:o.#e.set(e,0),o.log(`${e}: ${o.#e.get(e)}`);break;case!1:o.warn(`Counter "${e}" doesn’t exist`)}};static debug=(...e)=>{o.#s<4||(e=e.map((e=>`🅱️ ${e}`)),o.log(...e))};static error(...e){if(!(o.#s<1)){switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Quantumult X":default:e=e.map((e=>`❌ ${e}`));break;case"Node.js":e=e.map((e=>`❌ ${e.stack}`))}o.log(...e)}}static exception=(...e)=>o.error(...e);static group=e=>o.#t.unshift(e);static groupEnd=()=>o.#t.shift();static info(...e){o.#s<3||(e=e.map((e=>`ℹ️ ${e}`)),o.log(...e))}static#s=2;static get logLevel(){switch(o.#s){case 0:return"OFF";case 1:return"ERROR";case 2:default:return"WARN";case 3:return"INFO";case 4:return"DEBUG";case 5:return"ALL"}}static set logLevel(e){switch(typeof e){case"string":e=e.toLowerCase();break;case"number":break;default:e="warn"}switch(e){case 0:case"off":o.#s=0;break;case 1:case"error":o.#s=1;break;case 2:case"warn":case"warning":default:o.#s=2;break;case 3:case"info":o.#s=3;break;case 4:case"debug":o.#s=4;break;case 5:case"all":o.#s=5}}static log=(...e)=>{0!==o.#s&&(e=e.map((e=>{switch(typeof e){case"object":e=JSON.stringify(e);break;case"bigint":case"number":case"boolean":case"string":e=e.toString()}return e})),o.#t.forEach((t=>{e=e.map((e=>` ${e}`)),e.unshift(`▼ ${t}:`)})),e=["",...e],console.log(e.join("\n")))};static time=(e="default")=>o.#a.set(e,Date.now());static timeEnd=(e="default")=>o.#a.delete(e);static timeLog=(e="default")=>{const t=o.#a.get(e);t?o.log(`${e}: ${Date.now()-t}ms`):o.warn(`Timer "${e}" doesn’t exist`)};static warn(...e){o.#s<2||(e=e.map((e=>`⚠️ ${e}`)),o.log(...e))}}class r{static get(e={},t="",a=void 0){Array.isArray(t)||(t=r.toPath(t));const s=t.reduce(((e,t)=>Object(e)[t]),e);return void 0===s?a:s}static set(e,t,a){return Array.isArray(t)||(t=r.toPath(t)),t.slice(0,-1).reduce(((e,a,s)=>Object(e[a])===e[a]?e[a]:e[a]=/^\d+$/.test(t[s+1])?[]:{}),e)[t[t.length-1]]=a,e}static unset(e={},t=""){Array.isArray(t)||(t=r.toPath(t));const a=t.reduce(((e,a,s)=>s===t.length-1?(delete e[a],!0):Object(e)[a]),e);return a}static toPath(e){return e.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean)}static escape(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,(e=>t[e]))}static unescape(e){const t={"&":"&","<":"<",">":">",""":'"',"'":"'"};return e.replace(/&|<|>|"|'/g,(e=>t[e]))}}const i={100:"HTTP/1.1 100 Continue",101:"HTTP/1.1 101 Switching Protocols",102:"HTTP/1.1 102 Processing",103:"HTTP/1.1 103 Early Hints",200:"HTTP/1.1 200 OK",201:"HTTP/1.1 201 Created",202:"HTTP/1.1 202 Accepted",203:"HTTP/1.1 203 Non-Authoritative Information",204:"HTTP/1.1 204 No Content",205:"HTTP/1.1 205 Reset Content",206:"HTTP/1.1 206 Partial Content",207:"HTTP/1.1 207 Multi-Status",208:"HTTP/1.1 208 Already Reported",226:"HTTP/1.1 226 IM Used",300:"HTTP/1.1 300 Multiple Choices",301:"HTTP/1.1 301 Moved Permanently",302:"HTTP/1.1 302 Found",304:"HTTP/1.1 304 Not Modified",307:"HTTP/1.1 307 Temporary Redirect",308:"HTTP/1.1 308 Permanent Redirect",400:"HTTP/1.1 400 Bad Request",401:"HTTP/1.1 401 Unauthorized",402:"HTTP/1.1 402 Payment Required",403:"HTTP/1.1 403 Forbidden",404:"HTTP/1.1 404 Not Found",405:"HTTP/1.1 405 Method Not Allowed",406:"HTTP/1.1 406 Not Acceptable",407:"HTTP/1.1 407 Proxy Authentication Required",408:"HTTP/1.1 408 Request Timeout",409:"HTTP/1.1 409 Conflict",410:"HTTP/1.1 410 Gone",411:"HTTP/1.1 411 Length Required",412:"HTTP/1.1 412 Precondition Failed",413:"HTTP/1.1 413 Content Too Large",414:"HTTP/1.1 414 URI Too Long",415:"HTTP/1.1 415 Unsupported Media Type",416:"HTTP/1.1 416 Range Not Satisfiable",417:"HTTP/1.1 417 Expectation Failed",418:"HTTP/1.1 418 I'm a teapot",421:"HTTP/1.1 421 Misdirected Request",422:"HTTP/1.1 422 Unprocessable Entity",423:"HTTP/1.1 423 Locked",424:"HTTP/1.1 424 Failed Dependency",425:"HTTP/1.1 425 Too Early",426:"HTTP/1.1 426 Upgrade Required",428:"HTTP/1.1 428 Precondition Required",429:"HTTP/1.1 429 Too Many Requests",431:"HTTP/1.1 431 Request Header Fields Too Large",451:"HTTP/1.1 451 Unavailable For Legal Reasons",500:"HTTP/1.1 500 Internal Server Error",501:"HTTP/1.1 501 Not Implemented",502:"HTTP/1.1 502 Bad Gateway",503:"HTTP/1.1 503 Service Unavailable",504:"HTTP/1.1 504 Gateway Timeout",505:"HTTP/1.1 505 HTTP Version Not Supported",506:"HTTP/1.1 506 Variant Also Negotiates",507:"HTTP/1.1 507 Insufficient Storage",508:"HTTP/1.1 508 Loop Detected",510:"HTTP/1.1 510 Not Extended",511:"HTTP/1.1 511 Network Authentication Required"};const c=e=>{const t={};switch(typeof e){case void 0:break;case"string":case"number":case"boolean":switch(s){case"Surge":case"Stash":case"Egern":default:t.url=e;break;case"Loon":case"Shadowrocket":t.openUrl=e;break;case"Quantumult X":t["open-url"]=e;case"Node.js":}break;case"object":{const a=e.open||e["open-url"]||e.url||e.openUrl,o=e.copy||e["update-pasteboard"]||e.updatePasteboard,r=e.media||e["media-url"]||e.mediaUrl;switch(s){case"Surge":case"Stash":case"Egern":case"Shadowrocket":default:if(a&&(t.action="open-url",t.url=a),o&&(t.action="clipboard",t.text=o),r)switch(!0){case r.startsWith("http"):t["media-url"]=r;break;case r.startsWith("data:"):{const a=/^data:(?\w+\/\w+);base64,(?.+)/,{MIME:s,Base64:o}=r.match(a).groups;t["media-base64"]=o,t["media-base64-mime"]=e.mime||s;break}default:switch(t["media-base64"]=r,!0){case r.startsWith("CiVQREYt"):case r.startsWith("JVBERi0"):t["media-base64-mime"]="application/pdf";break;case r.startsWith("R0lGODdh"):case r.startsWith("R0lGODlh"):t["media-base64-mime"]="image/gif";break;case r.startsWith("iVBORw0KGgo"):t["media-base64-mime"]="image/png";break;case r.startsWith("/9j/"):t["media-base64-mime"]="image/jpg";break;case r.startsWith("Qk02U"):t["media-base64-mime"]="image/bmp"}}e["auto-dismiss"]&&(t["auto-dismiss"]=e["auto-dismiss"]),e.sound&&(t.sound=e.sound);break;case"Loon":a&&(t.openUrl=a),r?.startsWith("http")&&(t.mediaUrl=r);break;case"Quantumult X":a&&(t["open-url"]=a),r?.startsWith("http")&&(t["media-url"]=r),o&&(t["update-pasteboard"]=o);case"Node.js":}break}default:o.error("不支持的通知参数类型: "+typeof e,"")}return t};async function n(e,t){switch(e.constructor){case Object:e={...t,...e};break;case String:e={...t,url:e}}e.method||(e.method="GET",(e.body??e.bodyBytes)&&(e.method="POST")),delete e.headers?.Host,delete e.headers?.[":authority"],delete e.headers?.["Content-Length"],delete e.headers?.["content-length"];const a=e.method.toLocaleLowerCase();switch(s){case"Loon":case"Surge":case"Stash":case"Egern":case"Shadowrocket":default:if(e.timeout)switch(e.timeout=Number.parseInt(e.timeout,10),s){case"Loon":case"Shadowrocket":case"Stash":case"Egern":default:e.timeout=e.timeout/1e3;case"Surge":}if(e.policy)switch(s){case"Loon":e.node=e.policy;break;case"Stash":r.set(e,"headers.X-Stash-Selected-Proxy",encodeURI(e.policy));break;case"Shadowrocket":r.set(e,"headers.X-Surge-Proxy",e.policy)}switch("boolean"==typeof e.redirection&&(e["auto-redirect"]=e.redirection),e.bodyBytes&&!e.body&&(e.body=e.bodyBytes,e.bodyBytes=void 0),(e.headers?.Accept||e.headers?.accept)?.split(";")?.[0]){case"application/protobuf":case"application/x-protobuf":case"application/vnd.google.protobuf":case"application/vnd.apple.flatbuffer":case"application/grpc":case"application/grpc+proto":case"application/octet-stream":e["binary-mode"]=!0}return await new Promise(((t,s)=>{$httpClient[a](e,((a,o,r)=>{a?s(a):(o.ok=/^2\d\d$/.test(o.status),o.statusCode=o.status,r&&(o.body=r,1==e["binary-mode"]&&(o.bodyBytes=r)),t(o))}))}));case"Quantumult X":return e.policy&&r.set(e,"opts.policy",e.policy),"boolean"==typeof e["auto-redirect"]&&r.set(e,"opts.redirection",e["auto-redirect"]),e.body instanceof ArrayBuffer?(e.bodyBytes=e.body,e.body=void 0):ArrayBuffer.isView(e.body)?(e.bodyBytes=e.body.buffer.slice(e.body.byteOffset,e.body.byteLength+e.body.byteOffset),e.body=void 0):e.body&&(e.bodyBytes=void 0),await $task.fetch(e).then((e=>{switch(e.ok=/^2\d\d$/.test(e.statusCode),e.status=e.statusCode,(e.headers?.["Content-Type"]??e.headers?.["content-type"])?.split(";")?.[0]){case"application/protobuf":case"application/x-protobuf":case"application/vnd.google.protobuf":case"application/vnd.apple.flatbuffer":case"application/grpc":case"application/grpc+proto":case"application/octet-stream":e.body=e.bodyBytes}return e.bodyBytes=void 0,e}),(e=>Promise.reject(e.error)));case"Node.js":{const t=require("iconv-lite"),s=globalThis.got?globalThis.got:require("got"),r=globalThis.cktough?globalThis.cktough:require("tough-cookie"),i=globalThis.ckjar?globalThis.ckjar:new r.CookieJar;e&&(e.headers=e.headers?e.headers:{},void 0===e.headers.Cookie&&void 0===e.cookieJar&&(e.cookieJar=i));const{url:c,...n}=e;return await s[a](c,n).on("redirect",((e,t)=>{try{if(e.headers["set-cookie"]){const a=e.headers["set-cookie"].map(r.Cookie.parse).toString();a&&i.setCookieSync(a,null),t.cookieJar=i}}catch(e){o.error(e)}})).then((e=>(e.statusCode=e.status,e.body=t.decode(e.rawBody,"utf-8"),e.bodyBytes=e.rawBody,e)),(e=>Promise.reject(e.message)))}}}class d{static data=null;static dataFile="box.dat";static#o=/^@(?[^.]+)(?:\.(?.*))?$/;static getItem(e,t=null){let a=t;switch(e.startsWith("@")){case!0:{const{key:t,path:s}=e.match(d.#o)?.groups;e=t;let o=d.getItem(e,{});"object"!=typeof o&&(o={}),a=r.get(o,s);try{a=JSON.parse(a)}catch(e){}break}default:switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":a=$persistentStore.read(e);break;case"Quantumult X":a=$prefs.valueForKey(e);break;case"Node.js":d.data=d.#r(d.dataFile),a=d.data?.[e];break;default:a=d.data?.[e]||null}try{a=JSON.parse(a)}catch(e){}}return a??t}static setItem(e=new String,t=new String){let a=!1;if("object"==typeof t)t=JSON.stringify(t);else t=String(t);switch(e.startsWith("@")){case!0:{const{key:s,path:o}=e.match(d.#o)?.groups;e=s;let i=d.getItem(e,{});"object"!=typeof i&&(i={}),r.set(i,o,t),a=d.setItem(e,i);break}default:switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":a=$persistentStore.write(t,e);break;case"Quantumult X":a=$prefs.setValueForKey(t,e);break;case"Node.js":d.data=d.#r(d.dataFile),d.data[e]=t,d.#i(d.dataFile),a=!0;break;default:a=d.data?.[e]||null}}return a}static removeItem(e){let t=!1;switch(e.startsWith("@")){case!0:{const{key:a,path:s}=e.match(d.#o)?.groups;e=a;let o=d.getItem(e);"object"!=typeof o&&(o={}),keyValue=r.unset(o,s),t=d.setItem(e,o);break}default:switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Node.js":default:t=!1;break;case"Quantumult X":t=$prefs.removeValueForKey(e)}}return t}static clear(){let e=!1;switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Node.js":default:e=!1;break;case"Quantumult X":e=$prefs.removeAllValues()}return e}static#r=e=>{if("Node.js"!==s)return{};{this.fs=this.fs?this.fs:require("node:fs"),this.path=this.path?this.path:require("node:path");const t=this.path.resolve(e),a=this.path.resolve(process.cwd(),e),s=this.fs.existsSync(t),o=!s&&this.fs.existsSync(a);if(!s&&!o)return{};{const e=s?t:a;try{return JSON.parse(this.fs.readFileSync(e))}catch(e){return{}}}}};static#i=(e=this.dataFile)=>{if("Node.js"===s){this.fs=this.fs?this.fs:require("node:fs"),this.path=this.path?this.path:require("node:path");const t=this.path.resolve(e),a=this.path.resolve(process.cwd(),e),s=this.fs.existsSync(t),o=!s&&this.fs.existsSync(a),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):o?this.fs.writeFileSync(a,r):this.fs.writeFileSync(t,r)}}}const u=e=>{try{return JSON.parse(e)}catch{return e}},l=(e,...t)=>{if("string"==typeof e)return e;try{return JSON.stringify(e,...t)}catch{return e}};const p="undefined"!=typeof $argument?"object"==typeof $argument?$argument:Object.fromEntries($argument.split("&").map((e=>e.split("=")))):{},h="每天60秒读懂世界",b=((e,t=null)=>{const a=t?new Date(t):new Date;let s={"M+":a.getMonth()+1,"d+":a.getDate(),"H+":a.getHours(),"m+":a.getMinutes(),"s+":a.getSeconds(),"q+":Math.floor((a.getMonth()+3)/3),S:a.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(a.getFullYear()+"").substr(4-RegExp.$1.length)));for(let t in s)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[t]:("00"+s[t]).substr((""+s[t]).length)));return e})("yyyy-MM-dd"),g=()=>"Node.js"===s;!function(){const e=["本脚本仅用于学习研究,禁止用于商业用途","本脚本不保证准确性、可靠性、完整性和及时性","任何个人或组织均可无需经过通知而自由使用","作者对任何脚本问题概不负责,包括由此产生的任何损失","如有单位或个人认为本脚本侵权,请通知并提供证明,我将删除","请勿将本脚本用于商业用途,由此引起的问题与作者无关","本脚本及其更新版权归作者所有","",`⌚ ${(new Date).toLocaleString("zh-CN",{timeZone:"PRC"})}`];o.log("==============📣免责声明📣==============",...e)}(),o.logLevel="true"==`${g()?process.env.ZAOBAO_DEBUG:p.debug||d.getItem("zaobao_debug")}`?"debug":"info",o.info(`日志等级: ${o.logLevel}`);const y="true"==`${d.getItem("zaobao_original_url")}`,f=g()?process.env.ZAOBAO_BARK_KEY:d.getItem("zaobao_bark_key");async function m(){const e=await n(`https://raw.githubusercontent.com/vikiboss/60s-static-host/main/static/60s/${b}.json`);let t,a,r,i=h,d=await Promise.race([n("https://api.03c3.cn/api/zb").then((()=>"https://api.03c3.cn/api/zb")),n("https://api.2xb.cn/zaob").then((e=>u(e.body)?.imageUrl))]);if(e.ok){const s=u(e.body);i=h,t=s.tip,a=s.news.map(((e,t)=>`【${(e=>{const t=["𝟎","𝟏","𝟐","𝟑","𝟒","𝟓","𝟔","𝟕","𝟖","𝟗","𝐚","𝐛","𝐜","𝐝","𝐞","𝐟","𝐠","𝐡","𝐢","𝐣","𝐤","𝐥","𝐦","𝐧","𝐨","𝐩","𝐪","𝐫","𝐬","𝐭","𝐮","𝐯","𝐰","𝐱","𝐲","𝐳","𝐀","𝐁","𝐂","𝐃","𝐄","𝐅","𝐆","𝐇","𝐈","𝐉","𝐊","𝐋","𝐌","𝐍","𝐎","𝐏","𝐐","𝐑","𝐒","𝐓","𝐔","𝐕","𝐖","𝐗","𝐘","𝐙"],a={48:0,49:1,50:2,51:3,52:4,53:5,54:6,55:7,56:8,57:9,65:36,66:37,67:38,68:39,69:40,70:41,71:42,72:43,73:44,74:45,75:46,76:47,77:48,78:49,79:50,80:51,81:52,82:53,83:54,84:55,85:56,86:57,87:58,88:59,89:60,90:61,97:10,98:11,99:12,100:13,101:14,102:15,103:16,104:17,105:18,106:19,107:20,108:21,109:22,110:23,111:24,112:25,113:26,114:27,115:28,116:29,117:30,118:31,119:32,120:33,121:34,122:35};return e.replace(/[0-9A-z]/g,(e=>t[a[e.charCodeAt(0)]]))})(`${t+1}`.padStart(2,"0"))}】${e}`)),r=s.cover,y&&(d=s.link),o.group("📰content"),o.debug(...a),o.groupEnd()}else{t=await Promise.race([n("https://v1.hitokoto.cn/?c=a&encode=text").then((e=>e.body)),n("https://api.2xb.cn/RainbowWord").then((e=>e.body))]);const e="文字版接口暂未更新, 可尝试点击横幅跳转图文链接查看";o.warn(e),a=["⚠️ 异常通知",e]}o.group("🔈notification"),o.debug(i,t,d,r),o.groupEnd(),await async function(e,t,a,r){f?await async function(e,t,a,s={}){const r=s?.["open-url"]||s?.openUrl||s?.$open||s?.url||"",i=s?.["update-pasteboard"]||s?.updatePasteboard||s?.$copy||s?.copy||"",c=s?.["media-url"]||s?.mediaUrl||s?.$media||"";["open-url","openUrl","$open","url","update-pasteboard","updatePasteboard","$copy","copy","media-url","mediaUrl","$media"].forEach((e=>delete s[e])),t&&(a=t+"\n"+a);const d={...s,url:r,copy:i,icon:c,title:e,body:a},u={url:"https://api.day.app/"+f,headers:{"content-type":"application/json; charset=utf-8"},body:l(d)};for(let t=0;t<3;t++){o.info(`Bark第${t+1}次推送尝试`);const s=await n(u);if(s.ok){const t=["=========📣推送成功📣=========",e,a];r&&t.push(`跳转链接: ${r}`),i&&t.push(`复制内容: ${i}`),c&&t.push(`媒体链接: ${c}`),o.log(...t);break}o.warn("Bark推送失败",s.body||"")}}(e,t,a,r):function(e=`ℹ️ ${s} 通知`,t="",a="",r={}){switch(s){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":default:$notification.post(e,t,a,c(r));break;case"Quantumult X":$notify(e,t,a,c(r));case"Node.js":}o.log("==============📣系统通知📣==============",e,t,a,JSON.stringify(c(r),null,2))}(e,t,a,r)}(i,t,a.join("\n").replace(/\n$/,""),{mediaUrl:r,openUrl:d})}o.debug(f?"Bark密钥: "+f:"未开启Bark推送"),(async()=>{await m()})().catch((e=>{let t="";t=e instanceof Error?e.message:e,o.error(t)})).finally((function(e={}){switch(s){case"Surge":e.policy&&r.set(e,"headers.X-Surge-Policy",e.policy),o.log("🚩 执行结束!",`🕛 ${(new Date).getTime()/1e3-$script.startTime} 秒`),$done(e);break;case"Loon":e.policy&&(e.node=e.policy),o.log("🚩 执行结束!",`🕛 ${(new Date-$script.startTime)/1e3} 秒`),$done(e);break;case"Stash":e.policy&&r.set(e,"headers.X-Stash-Selected-Proxy",encodeURI(e.policy)),o.log("🚩 执行结束!",`🕛 ${(new Date-$script.startTime)/1e3} 秒`),$done(e);break;case"Egern":case"Shadowrocket":default:o.log("🚩 执行结束!"),$done(e);break;case"Quantumult X":switch(e.policy&&r.set(e,"opts.policy",e.policy),e["auto-redirect"]=void 0,e["auto-cookie"]=void 0,e["binary-mode"]=void 0,e.charset=void 0,e.host=void 0,e.insecure=void 0,e.method=void 0,e.ok=void 0,e.opt=void 0,e.path=void 0,e.policy=void 0,e["policy-descriptor"]=void 0,e.scheme=void 0,e.sessionIndex=void 0,e.statusCode=void 0,e.timeout=void 0,typeof e.status){case"number":e.status=i[e.status];break;case"string":case"undefined":break;default:e.status=void 0}e.body instanceof ArrayBuffer?(e.bodyBytes=e.body,e.body=void 0):ArrayBuffer.isView(e.body)?(e.bodyBytes=e.body.buffer.slice(e.body.byteOffset,e.body.byteLength+e.body.byteOffset),e.body=void 0):e.body&&(e.bodyBytes=void 0),o.log("🚩 执行结束!"),$done(e);break;case"Node.js":o.log("🚩 执行结束!"),process.exit(1)}}))})(); -------------------------------------------------------------------------------- /Tasks/95598/README.md: -------------------------------------------------------------------------------- 1 | # 网上国网 2 | 3 | > 20241111 4 | 5 | 更换域名 6 | 7 | surge面板不再维护, 建议小组件优先 8 | 9 | 仓库内的小组件是一种选择 10 | 11 | 另外推荐两款大佬的组件 12 | https://t.me/scriptable_CN/491447 13 | https://t.me/scriptable_CN/488952 14 | 15 | > 20240929 16 | 更新最新版小组件 17 | 18 | > 20240330 19 | 使用Env.js调试输出 20 | 修改使用滑块登录 21 | 22 | > 20240319 23 | 修复原版, 特别致谢一下@KleinerSource提出的疑问 24 | 25 | > 20240318 26 | 27 | 更新使用其他方式查询 28 | 详细请见脚本注释头部 29 | 30 | > 20231103 31 | 32 | 增加多户查询(默认全通知, 需要只通知默认请配置相关boxjs) 33 | 34 | 修改查询上月用电明细通知时间 35 | 36 | 优化通知文案 37 | 38 | 适配青龙面板, 需要使用第三方通知请注意sencNotify.js位置 39 | 40 | 优化代码, 减少冗余 41 | 42 | > 20231101 修复 1 号出问题的情况 43 | 44 | > 20231023 考虑到 Surge 通知不全, 去掉几个无用字段。 45 | 46 | > 20231019 新增 boxjs 订阅点击跳转通知即可。 47 | 48 | > 20231018 优化多户查找默认户号的逻辑, 增加一层过滤非住宅的情况。 49 | 50 | > 绑定多户显示默认户号信息, 处理文案使其更加优雅~ 51 | 52 | > 可查询电费、用电量、账户余额、预存电费、预计可用天数等信息。 53 | 54 | > 代码兼容 Surge & QuanX & Loon, 其他工具可自行测试。 55 | 56 | ## Quantumult X 配置 57 | 58 | ``` 59 | [task_local] 60 | 5 21 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/95598/95598.js, tag=网上国网查询, img-url=https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/83/d8/8a/83d88a92-5a4d-7a2f-118c-80d795e7a9f6/AppIcon-0-0-1x_U007emarketing-0-5-0-0-sRGB-85-220.png/144x144.png, enabled=true 61 | ``` 62 | 63 | ## Surge 配置 64 | 65 | ``` 66 | [Panel] 67 | 策略面板 = script-name=网上国网,update-interval=7200 68 | [Script] 69 | 网上国网 = type=cron,cronexp=0 5 21 * * *,wake-system=1,script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/95598/95598.js,timeout=60 70 | ``` 71 | 72 | ## Loon 配置 73 | 74 | ``` 75 | [Script] 76 | cron "5 21 * * *" script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/95598/95598.js, timeout=10, tag=网上国网, img-url=https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/83/d8/8a/83d88a92-5a4d-7a2f-118c-80d795e7a9f6/AppIcon-0-0-1x_U007emarketing-0-5-0-0-sRGB-85-220.png/144x144.png 77 | ``` 78 | 79 | ## 说明 80 | 81 | > **【公益鸡】 请将 corntab 定时自行设置, 避免对服务器造成并发压力** 82 | 83 | > 仅实现查询类功能 84 | 85 | > 添加 [分流](https://gist.githubusercontent.com/Yuheng0101/a7a432754e79bf2f653e2fb6ec1aa8ea/raw/DIRECT.list) 规则并指向直连 86 | 87 | > 务必添加 [BoxJS 订阅](https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/boxjs.json) 88 | 89 | > 应@小白脸要求添加 Surge Panel 面板支持 90 | 91 | 1.修改字段Surge Panel配置的值: {'title':'','content':'截至到{date},账户余额还有{sumMoney},上月用电{totalPq}','icon':'bolt.circle.fill','icon-color':'#ff0000'} 92 | 93 | 2.面板可用字段 totalPq -> 上月用电量 | sumMoney -> 账户余额 | prepayBal -> 预存电费 | dayNum -> 预计可用天数 | date -> 截止日期 94 | 95 | ## 感谢 96 | 97 | [@小白脸](https://t.me/yqc_123) 98 | 99 | [@Mutu888](https://github.com/githubdulong/Script) 100 | 101 | [@chavyleung](https://github.com/chavyleung) 102 | -------------------------------------------------------------------------------- /Tasks/Bdyy/README.md: -------------------------------------------------------------------------------- 1 | # 波点音乐 2 | 3 | ## 脚本注明 4 | 5 | 1. 不保证脚本合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 6 | 2. 本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 7 | 3. 转载脚本请注明来源,欢迎分享,拒绝倒卖,倒卖 🐕 必死 🐎。 8 | 4. 如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 9 | 5. 所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明, 本人保留随时更改或补充此声明的权利, 一旦您使用或复制了此脚本,即视为您已接受此免责声明。 10 | 6. 欢迎对[本仓库](https://github.com/Yuheng0101/X)Star✅,但请不要 Fork❌。 11 | 12 | ## 脚本描述 13 | 14 | - 签到领取会员(部分用户)。 15 | 16 | ## 使用方法 17 | 18 | - 登录`波点音乐` ➟ 打开`重写规则` ➟ 返回 APP 点击`我的`, 提示 ⟦获取 Cookie 成功⟧ 方可继续食用该脚本。 19 | 20 | ### 远程重写(抓取的时候打开, 抓取成功后关闭 -> 防止不必要的麻烦) 21 | 22 | > [Quantumult X](https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.conf) 23 | 24 | > [Surge](https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.sgmodule) 25 | 26 | > [Loon](https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.plugin) 27 | 28 | ## Quantumult X 配置 29 | 30 | ``` 31 | [task_local] 32 | 0 1 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js, tag=波点音乐自动签到, img-url=https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/05/b9/57/05b9577c-3773-cd2b-5a99-49c0dc3f331d/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/144x144.png, enabled=true 33 | ``` 34 | 35 | ## Surge 配置 36 | 37 | ``` 38 | [Script] 39 | 波点音乐自动签到 = type=cron,cronexp=0 1 * * * *,wake-system=1,script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js,timeout=60 40 | ``` 41 | 42 | ## Loon 配置 43 | 44 | ``` 45 | [Script] 46 | cron "0 1 * * *" script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js, timeout=10, tag=波点音乐自动签到, img-url=https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/05/b9/57/05b9577c-3773-cd2b-5a99-49c0dc3f331d/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/144x144.png 47 | ``` 48 | -------------------------------------------------------------------------------- /Tasks/Bdyy/bdyy.conf: -------------------------------------------------------------------------------- 1 | [mitm] 2 | hostname = bd-api.kuwo.cn 3 | 4 | [rewrite_local] 5 | ^https?:\/\/bd-api\.kuwo\.cn\/api\/ucenter\/users\/pub.+uid=\d+&token= url script-request-header https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js 6 | -------------------------------------------------------------------------------- /Tasks/Bdyy/bdyy.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 波点音乐 3 | * @channel https://t.me/yqc_123 4 | * @feedback https://t.me/yqc_777 5 | * @update 20231102 6 | * @version 1.0.0 7 | ******************************************/ 8 | const $ = new Env(`波点音乐`) 9 | const isRequest = typeof $request != 'undefined' 10 | const BDYY_ACCOUNT = JSON.parse($.getdata('bdyy_account') || '[]') 11 | class BdKuwo { 12 | constructor(uid, token, qimei36, devid) { 13 | this.uid = uid 14 | this.token = token 15 | this.qimei36 = qimei36 16 | this.devid = devid 17 | this.headers = { 18 | channel: 'appstore', 19 | plat: 'ip', 20 | net: 'wifi', 21 | brand: 'iPhone13,2', 22 | 'api-ver': 'application/json', 23 | svrver: '11', 24 | host: 'bd-api.kuwo.cn', 25 | 'accept-encoding': 'gzip', 26 | qimei36: this.qimei36, 27 | ver: '3.5.2', 28 | devid: this.devid, 29 | 'user-agent': 'Dart/2.19 (dart:io)', 30 | ultrahd: '1', 31 | h265supported: '1' 32 | } 33 | this.nickname = '' 34 | this.avatarUrl = '' 35 | this.resultMsg = '' 36 | } 37 | userInfo() { 38 | const options = { 39 | url: `https://bd-api.kuwo.cn/api/ucenter/users/pub/${this.uid}?fromUid=${this.uid}&uid=${this.uid}&token=${this.token}`, 40 | headers: this.headers 41 | } 42 | return new Promise((resolve) => { 43 | $.get(options, (err, response, body) => { 44 | try { 45 | if (err) { 46 | console.log(err) 47 | } else { 48 | body = JSON.parse(body) 49 | const { code, data, msg } = body 50 | if (code == 200) { 51 | const { 52 | userInfo: { nickname, headImg }, 53 | payInfo: { isVip, expireDate } 54 | } = data 55 | this.nickname = nickname 56 | this.avatarUrl = headImg 57 | // console.log(`\n🔔 ${this.nickname}, 头像: ${headImg}`) 58 | // console.log(`\n🔔 ${this.nickname}, 是否会员: ${isVip == 1 ? '是' : '否'}`) 59 | // console.log(`\n🔔 ${this.nickname}, 会员到期时间: ${$.time('yyyy-MM-dd qq HH:mm:ss', expireDate)}`) 60 | } else { 61 | console.log(msg) 62 | } 63 | } 64 | } catch (e) { 65 | console.log(e) 66 | } finally { 67 | resolve() 68 | } 69 | }) 70 | }) 71 | } 72 | async gift() { 73 | const options = { 74 | url: `https://bd-api.kuwo.cn/api/ucenter/vip/give/popup?action=play&uid=${this.uid}&token=${this.token}`, 75 | headers: this.headers 76 | } 77 | return new Promise((resolve) => { 78 | $.get(options, (err, response, body) => { 79 | try { 80 | if (err) { 81 | console.log(err) 82 | } else { 83 | body = JSON.parse(body) 84 | const { code, data, msg } = body 85 | if (code == 200) { 86 | if (Object.keys(data).length == 0) { 87 | this.resultMsg = '𝐒𝐢𝐠𝐧𝐞𝐝 𝐢𝐧 𝐭𝐨𝐝𝐚𝐲' 88 | } else { 89 | this.resultMsg = '𝐒𝐢𝐠𝐧 𝐢𝐧 𝐬𝐮𝐜𝐜𝐞𝐬𝐬𝐟𝐮𝐥𝐥𝐲' 90 | } 91 | } else { 92 | $.log(`\n🔔 ${this.nickname}, 签到失败: ${msg}`) 93 | } 94 | } 95 | } catch (e) { 96 | console.log(e) 97 | } finally { 98 | resolve() 99 | } 100 | }) 101 | }) 102 | } 103 | } 104 | ;(async () => { 105 | if (isRequest) { 106 | GetCookie() 107 | return 108 | } 109 | let message = '' 110 | for (let i = 0; i < BDYY_ACCOUNT.length; i++) { 111 | const { uid, token, qimei36, devid } = BDYY_ACCOUNT[i] 112 | const bdyy = new BdKuwo(uid, token, qimei36, devid) 113 | await bdyy.userInfo() 114 | $.log(`\n🔔 ${bdyy.nickname}, 开始签到`) 115 | await bdyy.gift() 116 | if (!bdyy.resultMsg) bdyy.resultMsg = '❌ 签到失败, 请查看日志' 117 | $.log(`\n🔔 ${bdyy.nickname}, ${bdyy.resultMsg}`) 118 | message += `【${bdyy.nickname}】${bdyy.resultMsg} 🎉\n` 119 | } 120 | $.msg($.name, '', message.replace(/\n$/, '')) 121 | })() 122 | .catch((e) => $.log('', `❗️${$.name}, 错误!`, e)) 123 | .finally(() => $.done()) 124 | function GetCookie() { 125 | if ($request.method.toUpperCase() == 'GET') { 126 | try { 127 | const uid = $request.url.match(/uid=(\d+)/)[1] 128 | const token = $request.url.match(/token=(\w+)/)[1] 129 | const { qimei36, devid } = $request.headers 130 | const index = BDYY_ACCOUNT.findIndex((item) => item.uid == uid) 131 | if (index == -1) { 132 | BDYY_ACCOUNT.push({ uid, token, qimei36, devid }) 133 | $.msg($.name, '添加Cookie: 成功', `用户ID: ${uid}\n用户Token: ${token}`) 134 | } else { 135 | BDYY_ACCOUNT[index].token = token 136 | BDYY_ACCOUNT[index].qimei36 = qimei36 137 | BDYY_ACCOUNT[index].devid = devid 138 | $.msg($.name, '更新Cookie: 成功', `用户ID: ${uid}\n用户Token: ${token}`) 139 | } 140 | $.setdata(JSON.stringify(BDYY_ACCOUNT), 'bdyy_account') 141 | } catch (e) { 142 | throw e 143 | } 144 | } 145 | } 146 | // prettier-ignore 147 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,a)=>{s.call(this,t,(t,s,r)=>{t?a(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const a=this.getdata(t);if(a)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 148 | -------------------------------------------------------------------------------- /Tasks/Bdyy/bdyy.plugin: -------------------------------------------------------------------------------- 1 | #!name = 波点音乐签到 2 | #!desc = 波点音乐获取Cookie 3 | #!openUrl = 4 | #!icon = https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/05/b9/57/05b9577c-3773-cd2b-5a99-49c0dc3f331d/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/120x120.png 5 | #!author = 𝘠𝘶𝘩𝘦𝘯𝘨 6 | #!date = 2023-11-02 7 | 8 | [Script] 9 | http-request ^https?:\/\/bd-api\.kuwo\.cn\/api\/ucenter\/users\/pub.+uid=\d+&token= script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js, timeout=60, tag=BDYYCookie 10 | 11 | [Mitm] 12 | hostname = bd-api.kuwo.cn -------------------------------------------------------------------------------- /Tasks/Bdyy/bdyy.sgmodule: -------------------------------------------------------------------------------- 1 | #!name= 波点音乐签到 2 | #!desc= 波点音乐获取Cookie 3 | 4 | [Script] 5 | BDYYCookie = type=http-request, pattern=^https?:\/\/bd-api\.kuwo\.cn\/api\/ucenter\/users\/pub.+uid=\d+&token=, max-size=3145728, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/Bdyy/bdyy.js, timeout=60, script-update-interval=0 6 | 7 | [MITM] 8 | hostname = %APPEND% bd-api.kuwo.cn -------------------------------------------------------------------------------- /Tasks/eshop/README.md: -------------------------------------------------------------------------------- 1 | ## 干毛的? 2 | 一个switch游戏打折监控脚本 3 | ## 食用方法 4 | * 打开重写规则脚本(eshop.conf) 5 | * 进入官网点击游戏详情页面关注该游戏 6 | * 关闭脚本 7 | * 运行Task脚本(eshop.js) 8 | ## 配置 (QuanX) 9 | 10 | ```properties 11 | 12 | [rewrite_remote] 13 | https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/eshop/eshop.js, update-interval=172800, opt-parser=true, enabled=true 14 | 15 | [task_local] 16 | 30 7 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/eshop/eshop.js, tag=eshop打折监控, enabled=true 17 | 18 | ``` 19 | ## 友情提示 20 | * 通知记录完游戏记得要关闭重写脚本, 避免每次打开游戏详情页面都会添加到关注列表 21 | * 重复游戏不会添加关注 22 | * 当天没有折扣的游戏不会通知 23 | * 有折扣的游戏会通知, 点击查看该游戏折扣相关详细信息 24 | * 脚本中自带清理游戏列表功能, isClear设置为true, 运行一次脚本即可 25 | ## 网站 26 | https://eshop-prices.com/ -------------------------------------------------------------------------------- /Tasks/eshop/eshop.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 𝐄𝐒𝐇𝐎𝐏 3 | * @description eshop打折监控, 详细见readme 4 | * @channel https://t.me/yqc_123 5 | * @feedback https://t.me/yqc_777 6 | * @author 𝒀𝒖𝒉𝒆𝒏𝒈 7 | * @update 202301120 8 | * @version 1.0.1 9 | ****************************************** 10 | hostname=eshop-price.com 11 | 12 | ^http[s]:\/\/eshop-prices\.com\/games url script-request-header https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/eshop/eshop.js 13 | ******************************************/ 14 | const $ = new Env('𝐄𝐒𝐇𝐎𝐏') 15 | const isRequest = $request !== undefined 16 | const followedList = JSON.parse($.getdata('eshop_followedList') || '[]') 17 | const isClear = $.getdata('eshop_isClear') || 'false' 18 | async function GetCookie() { 19 | if ($request.method === 'OPTIONS') return 20 | const gameNameMatch = $request.url.match(/games\/(\d+)-(.*)/) 21 | if (gameNameMatch) { 22 | const gameName = gameNameMatch[2].replace(/-/g, '+').replace(/\?.*/g, ''), 23 | name = gameName.replace(/\+/g, ' '), 24 | index = followedList.findIndex((item) => item === gameName) 25 | if (index === -1) { 26 | followedList.push(gameName) 27 | await SendNotify('🎮', '关注成功', name) 28 | } else { 29 | $.log('🎮', '已关注', name) 30 | } 31 | $.setdata(JSON.stringify(followedList), 'eshop_followedList') 32 | } else { 33 | $.log('❌', '未匹配到关注的游戏, 不加入关注列表') 34 | } 35 | } 36 | function Query(name) { 37 | return new Promise(async (resolve) => { 38 | try { 39 | const { body } = await $.http.get(`https://eshop-prices.com/games?q=${name}`) 40 | let html = body.replace(/
(.*?)<\/h5>/g, (_, p1) => `
${p1.replaceAll(/\s/g, ' ')}
`).replace(/[\s\n]/g, '') 41 | let item = html.match(//g)[0] 42 | let link = baseURL + item.match(/href=\"(.*?)\"/)[1] 43 | let thumb = item.match(/src=\"(.*?)\"/)[1] 44 | let title = item.match(/h5>(.*?)<\/h5>/)[1].replace(/ /g, ' ') 45 | let discountMatch = item.match(/(.*?)<\/span>/) 46 | let discount = discountMatch ? discountMatch[1].replace(/%.*/, '%') : '' 47 | let priceMatch = item.match(/(.*?)<\/del>(.*?)<\/span>/) 48 | let [oldPrice, price] = priceMatch ? [priceMatch[1] || '', priceMatch[2] || ''] : ['', ''] 49 | resolve({ link, thumb, title, discount, oldPrice, price }) 50 | } catch (e) { 51 | $.logErr(e, resp) 52 | resolve({}) 53 | } 54 | }) 55 | } 56 | !(async () => { 57 | if (isRequest) { 58 | GetCookie() 59 | return 60 | } 61 | if (isClear === 'true') { 62 | $.setdata('', 'eshop_followedList') 63 | return await SendNotify('清除成功!') 64 | } 65 | if (followedList.length === 0) { 66 | return await SendNotify('请先添加关注店铺!') 67 | } 68 | $.log('', '🎮关注列表', followedList.join('\n'), '') 69 | for (const name of followedList) { 70 | let { link, thumb, title, discount, oldPrice, price } = await Query(name) 71 | if (!discount) { 72 | $.log('🎮', '无折扣', title) 73 | continue 74 | } else { 75 | const msg = `🎮${title}\n🎁${discount}\n💰${oldPrice} ➠ ${price}` 76 | await SendNotify('折扣提醒', '', msg, { 'media-url': thumb, 'open-url': link }) 77 | } 78 | } 79 | })() 80 | .catch((e) => $.logErr(e)) 81 | .finally(() => $.done()) 82 | async function SendNotify(t, n = '', o = '', e = {}) { 83 | const s = 'undefined' != typeof $app && 'undefined' != typeof $http, 84 | i = e['open-url'], 85 | r = e['media-url'] 86 | if (($.isQuanX() && $notify(t, n, o, e), $.isSurge())) { 87 | const e = r ? `${o}\n多媒体:${r}` : o 88 | $notification.post(t, n, e, { url: i }) 89 | } 90 | if ($.isLoon()) { 91 | const e = {} 92 | i && (e.openUrl = i), r && (e.mediaUrl = r), '{}' === JSON.stringify(e) ? $notification.post(t, n, o) : $notification.post(t, n, o, e) 93 | } 94 | const c = `${o}${i ? `\n点击跳转: ${i}` : ''}${r ? `\n多媒体: ${r}` : ''}` 95 | if (s) { 96 | const o = require('push') 97 | o.schedule({ title: t, body: `${n ? `${n}\n` : ''}${c}` }) 98 | } 99 | if ($.isNode()) 100 | try { 101 | const o = require('../sendNotify') 102 | await o.sendNotify(`${t}\n${n}`, c) 103 | } catch (t) { 104 | console.log('没有找到sendNotify.js文件') 105 | } 106 | console.log(`${t}\n${n}\n${c}\n\n`) 107 | } 108 | 109 | // prettier-ignore 110 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,a)=>{s.call(this,t,(t,s,r)=>{t?a(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const a=this.getdata(t);if(a)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} -------------------------------------------------------------------------------- /Tasks/meitu/meitu.sgmodule: -------------------------------------------------------------------------------- 1 | #!name=美图欣赏 2 | #!desc=多看美图助于身心健康😊 3 | 4 | [Script] 5 | meitu = type=http-request, pattern=^https?:\/\/mei\.tu, script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/meitu/meitu.js, requires-body=true, max-size=-1, timeout=60 6 | 7 | 美图鉴赏 = type=cron, cronexp="30 20 * * *", script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/meitu/meitu.js, timeout=120, wake-system=1 8 | 9 | [MITM] 10 | hostname = %APPEND% mei.tu -------------------------------------------------------------------------------- /Tasks/meitu/meitu.snippet: -------------------------------------------------------------------------------- 1 | [mitm] 2 | hostname = mei.tu 3 | 4 | [rewrite_local] 5 | ^https?:\/\/mei\.tu url script-analyze-echo-response https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/meitu/meitu.js 6 | -------------------------------------------------------------------------------- /Tasks/mi/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Tasks/mi/color.png -------------------------------------------------------------------------------- /Tasks/mi/mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yuheng0101/X/3e7e69d7dbb7d77a2e611f7142411d9ca4c27869/Tasks/mi/mini.png -------------------------------------------------------------------------------- /Tasks/ql.js: -------------------------------------------------------------------------------- 1 | const $ = new Env("京东COOKIE同步青龙"); 2 | $.isNode() && require("dotenv").config(); 3 | let QL_HOST = $.isNode() 4 | ? process.env.QL_HOST 5 | : $.getdata("yuheng_ql_host") || ""; 6 | let QL_CLIENT_ID = $.isNode() 7 | ? process.env.QL_CLIENT_ID 8 | : $.getdata("yuheng_ql_clientid") || ""; 9 | let QL_CLIENT_SECRET = $.isNode() 10 | ? process.env.QL_CLIENT_SECRET 11 | : $.getdata("yuheng_ql_clientsecret") || ""; 12 | !(async () => { 13 | if (!QL_HOST || !QL_CLIENT_ID || !QL_CLIENT_SECRET) { 14 | $.log("请填写青龙面板地址和密钥"); 15 | return; 16 | } 17 | ql = new QingLong(QL_HOST, QL_CLIENT_ID, QL_CLIENT_SECRET); 18 | try { 19 | await ql.checkLogin(); 20 | if (ql.token) { 21 | $.msg("青龙面板", "", "✅测试连接成功!"); 22 | } else { 23 | $.msg("青龙面板", "", "❌测试连接失败, 请检查账号密码是否正确!"); 24 | } 25 | } catch (e) { 26 | throw e; 27 | } 28 | })() 29 | .catch((e) => $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "")) 30 | .finally(() => $.done()); 31 | /* 32 | 对接青龙面板 33 | 适配 Node.js、QX、Loon、Surge等平台 34 | */ 35 | function QingLong(HOST, Client_ID, Client_Secret) { 36 | const Request = (options, method = "GET") => { 37 | if ( 38 | $.isNode() && 39 | options.hasOwnProperty("use_proxy") && 40 | options.use_proxy 41 | ) { 42 | require("dotenv").config(); 43 | const PROXY_HOST = process.env.PROXY_HOST || "127.0.0.1"; 44 | const PROXY_PORT = process.env.PROXY_PORT || 7890; 45 | const tunnel = require("tunnel"); 46 | const agent = { 47 | https: tunnel.httpsOverHttp({ 48 | proxy: { host: PROXY_HOST, port: PROXY_PORT * 1 }, 49 | }), 50 | }; 51 | Object.assign(options, { agent }); 52 | } 53 | return new Promise((resolve, reject) => { 54 | $.http[method.toLowerCase()](options) 55 | .then((response) => { 56 | var resp = response.body; 57 | try { 58 | resp = JSON.parse(resp); 59 | } catch (e) {} 60 | resolve(resp); 61 | }) 62 | .catch((err) => reject(err)); 63 | }); 64 | }; 65 | return new (class { 66 | /** 67 | * 对接青龙API 68 | * @param {*} HOST http://127.0.0.1:5700 69 | * @param {*} Client_ID xxx 70 | * @param {*} Client_Secret xxx 71 | */ 72 | constructor(HOST, Client_ID, Client_Secret) { 73 | this.host = HOST ? (HOST.endsWith("/") ? HOST : HOST + "/") : ""; 74 | this.clientId = Client_ID; 75 | this.clientSecret = Client_Secret; 76 | this.token = ""; 77 | this.envs = []; 78 | } 79 | // 检查登录状态 80 | async checkLogin() { 81 | let tokenObj; 82 | try { 83 | tokenObj = JSON.parse($.getdata("yuheng_ql_token") || "{}"); 84 | } catch (e) { 85 | console.log(`❌The token is invalid, please re-enter the token`); 86 | await this.getAuthToken(); 87 | return false; 88 | } 89 | if (Object.keys(tokenObj).length > 0) { 90 | const { token, expiration } = tokenObj; 91 | const currentTime = new Date().getTime(); 92 | if (currentTime > expiration) { 93 | $.log("❌The token has expired"); 94 | await this.getAuthToken(); 95 | } else { 96 | this.token = token; 97 | $.log( 98 | `✅The token is successfully obtained (${ 99 | this.token 100 | }) from cache and is valid until ${$.time( 101 | "yyyy-MM-dd HH:mm:ss", 102 | expiration 103 | )}` 104 | ); 105 | } 106 | } else { 107 | await this.getAuthToken(); 108 | } 109 | } 110 | // 获取用户密钥 111 | async getAuthToken() { 112 | const options = { 113 | url: `${this.host}open/auth/token`, 114 | params: { 115 | client_id: this.clientId, 116 | client_secret: this.clientSecret, 117 | }, 118 | }; 119 | try { 120 | console.log(`传入参数: ${JSON.stringify(options)}`); 121 | const { code, data, message } = await Request(options); 122 | if (code === 200) { 123 | const { token, token_type, expiration } = data; 124 | $.log( 125 | `✅The token is successfully obtained: ${token} and is valid until ${$.time( 126 | "yyyy-MM-dd HH:mm:ss", 127 | expiration * 1e3 128 | )}` 129 | ); 130 | this.token = `${token_type} ${token}`; 131 | $.setdata( 132 | JSON.stringify({ 133 | token: this.token, 134 | expiration: expiration * 1e3, 135 | }), 136 | "yuheng_ql_token" 137 | ); 138 | } else { 139 | throw message || "Failed to obtain user token."; 140 | } 141 | } catch (e) { 142 | throw e 143 | ? typeof e === "object" 144 | ? JSON.stringify(e) 145 | : e 146 | : "Network Error."; 147 | } 148 | } 149 | /** 150 | * 获取所有环境变量详情 151 | */ 152 | async getEnvs() { 153 | const options = { 154 | url: `${this.host}open/envs`, 155 | headers: { 156 | Authorization: `${this.token}`, 157 | }, 158 | }; 159 | try { 160 | const { code, data, message } = await Request(options); 161 | if (code === 200) { 162 | this.envs = data; 163 | $.log(`✅Obtaining environment variables succeeded.`); 164 | } else { 165 | throw message || `Failed to obtain the environment variable.`; 166 | } 167 | } catch (e) { 168 | throw e 169 | ? typeof e === "object" 170 | ? JSON.stringify(e) 171 | : e 172 | : "Network Error."; 173 | } 174 | } 175 | checkEnvByName(name) { 176 | return this.envs.findIndex((item) => item.name === name); 177 | } 178 | checkEnvByRemarks(remarks) { 179 | return this.envs.findIndex((item) => item.remarks === remarks); 180 | } 181 | checkEnvByValue(value, regex) { 182 | const match = value.match(regex); 183 | if (match) { 184 | const index = this.envs.findIndex((item) => 185 | item.value.includes(match[0]) 186 | ); 187 | if (index > -1) { 188 | $.log(`🆗${value} Matched: ${match[0]}`); 189 | return index; 190 | } else { 191 | $.log(`⭕${value} No Matched`); 192 | return -1; 193 | } 194 | } else { 195 | $.log(`⭕${value} No Matched`); 196 | return -1; 197 | } 198 | } 199 | /** 200 | * 添加环境变量 201 | * @param {*} array [{value:'变量值',name:'变量名',remarks:'备注'}] 202 | */ 203 | async addEnv(array) { 204 | const options = { 205 | url: `${this.host}open/envs`, 206 | headers: { 207 | Authorization: `${this.token}`, 208 | "Content-Type": "application/json;charset=UTF-8", 209 | }, 210 | body: JSON.stringify(array), 211 | }; 212 | try { 213 | const { code, message } = await Request(options, "post"); 214 | if (code === 200) { 215 | $.log(`✅The environment variable was added successfully.`); 216 | } else { 217 | throw message || "Failed to add the environment variable."; 218 | } 219 | } catch (e) { 220 | throw e 221 | ? typeof e === "object" 222 | ? JSON.stringify(e) 223 | : e 224 | : "Network Error."; 225 | } 226 | } 227 | /** 228 | * 修改环境变量 229 | * @param {*} obj {value:'变量值',name:'变量名',remarks:'备注',id:0} 230 | */ 231 | async updateEnv(obj) { 232 | const options = { 233 | url: `${this.host}open/envs`, 234 | method: "put", 235 | headers: { 236 | Authorization: `${this.token}`, 237 | "Content-Type": "application/json;charset=UTF-8", 238 | }, 239 | body: JSON.stringify(obj), 240 | }; 241 | try { 242 | const { code, message } = await Request(options, "post"); 243 | if (code === 200) { 244 | $.log(`✅The environment variable was updated successfully.`); 245 | await this.enableEnv([obj._id]); 246 | } else { 247 | throw message || "Failed to update the environment variable."; 248 | } 249 | } catch (e) { 250 | throw e 251 | ? typeof e === "object" 252 | ? JSON.stringify(e) 253 | : e 254 | : "Network Error."; 255 | } 256 | } 257 | /** 258 | * 删除环境变量 259 | * @param {*} ids [0,1,2] -> id数组 260 | */ 261 | async deleteEnv(ids) { 262 | const options = { 263 | url: `${this.host}open/envs`, 264 | method: "delete", 265 | headers: { 266 | Authorization: `${this.token}`, 267 | "Content-Type": "application/json;charset=UTF-8", 268 | }, 269 | body: JSON.stringify(ids), 270 | }; 271 | try { 272 | const { code, message } = await Request(options, "post"); 273 | if (code === 200) { 274 | $.log(`✅The environment variable was deleted successfully.`); 275 | } else { 276 | throw message || "Failed to delete the environment variable."; 277 | } 278 | } catch (e) { 279 | throw e 280 | ? typeof e === "object" 281 | ? JSON.stringify(e) 282 | : e 283 | : "Network Error."; 284 | } 285 | } 286 | /** 287 | * 启用环境变量 288 | * @param {*} ids [0,1,2] -> id数组 289 | */ 290 | async enableEnv(ids) { 291 | const options = { 292 | url: `${this.host}open/envs/enable`, 293 | method: "put", 294 | headers: { 295 | Authorization: `${this.token}`, 296 | "Content-Type": "application/json;charset=UTF-8", 297 | }, 298 | body: JSON.stringify(ids), 299 | }; 300 | try { 301 | const { code, message } = await Request(options, "post"); 302 | if (code === 200) { 303 | $.log(`✅The environment variable was enabled successfully.`); 304 | } else { 305 | throw message || "Failed to enable the environment variable."; 306 | } 307 | } catch (e) { 308 | throw e 309 | ? typeof e === "object" 310 | ? JSON.stringify(e) 311 | : e 312 | : "Network Error."; 313 | } 314 | } 315 | /** 316 | * 获取单个环境变量详情 317 | * @param {*} id 318 | * @returns 变量id 319 | */ 320 | async getEnvById(id) { 321 | const options = { 322 | url: `${this.host}open/envs/${id}`, 323 | headers: { 324 | Authorization: `${this.token}`, 325 | }, 326 | }; 327 | try { 328 | const { code, data, message } = await Request(options); 329 | if (code === 200) { 330 | return data; 331 | } else { 332 | throw message || `Failed to get the environment variable.`; 333 | } 334 | } catch (e) { 335 | throw e 336 | ? typeof e === "object" 337 | ? JSON.stringify(e) 338 | : e 339 | : "Network Error."; 340 | } 341 | } 342 | })(HOST, Client_ID, Client_Secret); 343 | } 344 | // prettier-ignore 345 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,a)=>{s.call(this,t,(t,s,r)=>{t?a(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const a=this.getdata(t);if(a)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,a)=>e(a))})}runScript(t,e){return new Promise(s=>{let a=this.getdata("@chavy_boxjs_userCfgs.httpapi");a=a?a.replace(/\n/g,"").trim():a;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[i,o]=a.split("@"),n={url:`http://${o}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":i,Accept:"*/*"},timeout:r};this.post(n,(t,e,a)=>s(a))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e);if(!s&&!a)return{};{const a=s?t:e;try{return JSON.parse(this.fs.readFileSync(a))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),a=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):a?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const a=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of a)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,a)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[a+1])>>0==+e[a+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,a]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,a,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,a,r]=/^@(.*?)\.(.*?)$/.exec(e),i=this.getval(a),o=a?"null"===i?null:i||"{}":"{}";try{const e=JSON.parse(o);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),a)}catch(e){const i={};this.lodash_set(i,r,t),s=this.setval(JSON.stringify(i),a)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:a,statusCode:r,headers:i,rawBody:o}=t,n=s.decode(o,this.encoding);e(null,{status:a,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:a,response:r}=t;e(a,r,r&&s.decode(r.rawBody,this.encoding))})}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,(t,s,a)=>{!t&&s&&(s.body=a,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,a)});break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:a,headers:r,body:i,bodyBytes:o}=t;e(null,{status:s,statusCode:a,headers:r,body:i,bodyBytes:o},i,o)},t=>e(t&&t.error||"UndefinedError"));break;case"Node.js":let a=require("iconv-lite");this.initGotEnv(t);const{url:r,...i}=t;this.got[s](r,i).then(t=>{const{statusCode:s,statusCode:r,headers:i,rawBody:o}=t,n=a.decode(o,this.encoding);e(null,{status:s,statusCode:r,headers:i,rawBody:o,body:n},n)},t=>{const{message:s,response:r}=t;e(s,r,r&&a.decode(r.rawBody,this.encoding))})}}time(t,e=null){const s=e?new Date(e):new Date;let a={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in a)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?a[e]:("00"+a[e]).substr((""+a[e]).length)));return t}queryStr(t){let e="";for(const s in t){let a=t[s];null!=a&&""!==a&&("object"==typeof a&&(a=JSON.stringify(a)),e+=`${s}=${a}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",a="",r){const i=t=>{switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{let e=t.url||t.openUrl||t["open-url"];return{url:e}}case"Loon":{let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}case"Quantumult X":{let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl,a=t["update-pasteboard"]||t.updatePasteboard;return{"open-url":e,"media-url":s,"update-pasteboard":a}}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,a,i(r));break;case"Quantumult X":$notify(e,s,a,i(r));break;case"Node.js":}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),a&&t.push(a),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t.stack)}}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 346 | -------------------------------------------------------------------------------- /Tasks/top.js: -------------------------------------------------------------------------------- 1 | /****************************************** 2 | * @name 热搜榜单 3 | * @platform 微博、知乎、头条、抖音、百度、哔哩哔哩、百度贴吧 4 | * @author 𝐎𝐍𝐙𝟑𝐕 5 | * @update 20241017 6 | * @version 1.1.0 7 | ****************************************** 8 | 脚本声明: 9 | 1.此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 10 | 2.由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 11 | 3.请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。 12 | 4.此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 13 | 5.本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 14 | 6.如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 15 | 7.所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明, 本人保留随时更改或补充此声明的权利, 一旦您使用或复制了此脚本,即视为您已接受此免责声明。 16 | 17 | 脚本说明: 18 | 提供两种通知类型进行选择 19 | 1. 根据每周日期来选择通知榜单, 如周一对应微博、周二对应抖音... 20 | 2. 用户可以在BoxJS中配置对应的通知类型 21 | 22 | ************************ 23 | Node.js说明: 24 | ************************ 25 | 需自行安装"got"与"iconv-lite"模块. 例: npm install got iconv-lite -g 26 | 变量名称: 27 | # > 是否开启调试模式 28 | export TOP_DEBUG = false // 默认关闭 29 | # > 用户自选类型 30 | export TOP_USER_SELECT = 0 // 默认系统帮选 31 | 32 | ************************ 33 | Quantumult X配置: 34 | ************************ 35 | 36 | [task_local] 37 | 30 6-23 * * * https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/top.js, tag=热搜榜单, img-url=https://is3-ssl.mzstatic.com/image/thumb/Purple126/v4/9a/d8/77/9ad877c6-e3d7-61a1-3911-5036239a41a6/AppIcon-1x_U007emarketing-0-7-0-0-sRGB-85-220.png/144x144bb.png, enabled=true 38 | 39 | ************************ 40 | Loon配置: 41 | ************************ 42 | 43 | [Script] 44 | cron "30 6-23 * * *" script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/top.js, timeout=10, tag=热搜榜单, img-url=https://is3-ssl.mzstatic.com/image/thumb/Purple126/v4/9a/d8/77/9ad877c6-e3d7-61a1-3911-5036239a41a6/AppIcon-1x_U007emarketing-0-7-0-0-sRGB-85-220.png/144x144bb.png 45 | 46 | ************************ 47 | Surge配置: 48 | ************************ 49 | [Script] 50 | 热搜榜单 = type=cron,cronexp=0 30 6-23 * * *,wake-system=1,script-path=https://raw.githubusercontent.com/Yuheng0101/X/main/Tasks/top.js,timeout=60 51 | 52 | ******************************************/ 53 | const $ = new Env("热搜榜"); 54 | const CATEGORY = [ 55 | { 56 | name: "微博", 57 | req: "https://weibo.com/ajax/statuses/hot_band", 58 | res: "data.band_list[0].word", 59 | }, 60 | { 61 | name: "抖音", 62 | req: "https://aweme.snssdk.com/aweme/v1/hot/search/list/", 63 | res: "data.word_list[0].word", 64 | }, 65 | { 66 | name: "今日头条", 67 | req: "https://www.toutiao.com/hot-event/hot-board/?origin=toutiao_pc", 68 | res: "data[0].Title", 69 | }, 70 | { 71 | name: "百度", 72 | req: `https://top.baidu.com/board?tab=realtime`, 73 | before: (body) => $.toObj(body.match(//)[1]).cards[0], 74 | res: "content[0].word", 75 | }, 76 | { 77 | name: "百度贴吧", 78 | req: "https://tieba.baidu.com/hottopic/browse/topicList", 79 | res: "data.bang_topic.topic_list[0].topic_name", 80 | }, 81 | { 82 | name: "哔哩哔哩", 83 | req: "https://api.bilibili.com/x/web-interface/ranking/v2", 84 | res: "data.list[0].title", 85 | }, 86 | { 87 | name: "知乎", 88 | req: "https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=15&desktop=true", 89 | res: "data[0].target.title", 90 | }, 91 | ]; 92 | // ./sendNotify 93 | const notify = $.isNode() ? require("./sendNotify") : ""; 94 | // 调试模式 95 | $.logLevel = $.toObj($.isNode() ? process.env[`TOP_DEBUG`] : $.getdata(`top_debug`)) ? "debug" : "info"; 96 | // 用户选择 97 | $.selected = $.isNode() ? process.env.TOP_USER_SELECT : $.getdata("top_user_select"); 98 | // 展示条数, 默认只显示top10 99 | $.limit = $.isNode() ? process.env.TOP_LIMIT : $.getdata("top_limit") || 10; 100 | const getList = async (item) => { 101 | let opts = item.req; 102 | opts = typeof opts === "string" ? { url: opts } : opts; 103 | const method = opts?.method ? opts.method.toLowerCase() : !!opts?.body ? "post" : "get"; 104 | // 百度不能设置ua 105 | if (item.name !== "百度") 106 | $.lodash_set(opts, "headers.user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"); 107 | delete opts.method; 108 | try { 109 | const { body } = await new Promise((resolve, reject) => { 110 | $[method](opts, (err, resp, body) => { 111 | if (err) reject(new Error(err)); 112 | else resolve({ resp, body }); 113 | }); 114 | }); 115 | let data; 116 | if (item?.before && typeof item.before === "function") { 117 | data = item.before(body); 118 | if (!item?.res) return data; 119 | } else { 120 | data = $.toObj(body); 121 | } 122 | const [l, i] = item.res.split("[0]."); 123 | const list = $.lodash_get(data, l).map((item) => $.lodash_get(item, i)); 124 | return list; 125 | } catch (e) { 126 | $.logErr(e); 127 | return []; 128 | } 129 | }; 130 | 131 | !(async () => { 132 | let request; 133 | if ($.selected) { 134 | const category = CATEGORY.map((it) => it.name); 135 | if (category.includes($.selected)) { 136 | request = CATEGORY.find((it) => it.name === $.selected); 137 | $.stitle = `[${request.name}热搜]`; 138 | $.debug(`当前用户选择的是: ${$.selected}`); 139 | $.debug(`请求参数: ${JSON.stringify(request.req)}`); 140 | } else $.debug(`当前填写分类不属于[${category.join(",")}]`); 141 | } 142 | if (!request) { 143 | $.debug(`系统进行自选操作`); 144 | const today = getWeek(); 145 | $.stitle = `今天是${today.str}`; 146 | request = CATEGORY[today.num]; 147 | $.stitle += `,为你推荐[${request.name}]热搜`; 148 | } 149 | let list = await getList(request); 150 | if (!list.length) throw new Error("获取热搜榜单失败..."); 151 | if ($.limit < 0 || $.limit > list.length) { 152 | $.error(`当前设置[limit]不合法, 已默认为10`); 153 | $.limit = 10; 154 | } else { 155 | $.limit = $.isNode() ? list.length : Number($.limit); 156 | $.debug(`设置的[limit]为: ${$.limit}`); 157 | } 158 | $.content = list 159 | .map((it, idx) => `【${operator((idx + 1).toString().padStart(2, "0"))}】${it}`) 160 | .slice(0, $.limit) 161 | .join("\n") 162 | .replace(/\n$/, ""); 163 | // $.msg($.name, $.stitle, $.content) 164 | await showMsg($.name, $.stitle, $.content); 165 | })() 166 | .catch((error) => $.logErr(error)) 167 | .finally(() => $.done({})); 168 | function getWeek() { 169 | const chinese_str = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; 170 | const day = new Date().getDay(); 171 | return { 172 | str: chinese_str[day], 173 | num: day, 174 | }; 175 | } 176 | async function showMsg(n, o, i, t) { 177 | if ($.isNode()) { 178 | const content = [i]; 179 | const openUrl = t?.["open-url"] || t?.url || t?.mediaUrl || t?.$open; 180 | const mediaUrl = t?.["media-url"] || t?.mediaUrl || t?.$media; 181 | openUrl && content.push(`🔗打开链接: ${openUrl}`); 182 | mediaUrl && content.push(`🎬媒体链接: ${mediaUrl}`); 183 | $.log("==============📣系统通知📣==============", n, o, content.join("\n")); 184 | try { 185 | await notify.sendNotify(`${n}\n${o}`, content.join("\n")); 186 | } catch (e) { 187 | $.warn("没有找到sendNotify.js文件 不发送通知"); 188 | } 189 | } else { 190 | // !$.notifyWithMedia && ['media-url', 'mediaUrl', '$media'].map((key) => delete t[key]) 191 | await $.msg(n, o, i, t); 192 | } 193 | } 194 | // prettier-ignore 195 | function operator(r){const e=["𝟎","𝟏","𝟐","𝟑","𝟒","𝟓","𝟔","𝟕","𝟖","𝟗","𝐚","𝐛","𝐜","𝐝","𝐞","𝐟","𝐠","𝐡","𝐢","𝐣","𝐤","𝐥","𝐦","𝐧","𝐨","𝐩","𝐪","𝐫","𝐬","𝐭","𝐮","𝐯","𝐰","𝐱","𝐲","𝐳","𝐀","𝐁","𝐂","𝐃","𝐄","𝐅","𝐆","𝐇","𝐈","𝐉","𝐊","𝐋","𝐌","𝐍","𝐎","𝐏","𝐐","𝐑","𝐒","𝐓","𝐔","𝐕","𝐖","𝐗","𝐘","𝐙"],o={48:0,49:1,50:2,51:3,52:4,53:5,54:6,55:7,56:8,57:9,65:36,66:37,67:38,68:39,69:40,70:41,71:42,72:43,73:44,74:45,75:46,76:47,77:48,78:49,79:50,80:51,81:52,82:53,83:54,84:55,85:56,86:57,87:58,88:59,89:60,90:61,97:10,98:11,99:12,100:13,101:14,102:15,103:16,104:17,105:18,106:19,107:20,108:21,109:22,110:23,111:24,112:25,113:26,114:27,115:28,116:29,117:30,118:31,119:32,120:33,121:34,122:35};return r.replace(/[0-9A-z]/g,(r=>e[o[r.charCodeAt(0)]]))} 196 | // prettier-ignore 197 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;"POST"===e&&(s=this.post);const i=new Promise(((e,i)=>{s.call(this,t,((t,s,o)=>{t?i(t):e(s)}))}));return t.timeout?((t,e=1e3)=>Promise.race([t,new Promise(((t,s)=>{setTimeout((()=>{s(new Error("请求超时"))}),e)}))]))(i,t.timeout):i}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null,...s){try{return JSON.stringify(t,...s)}catch{return e}}getjson(t,e){let s=e;if(this.getdata(t))try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise((e=>{this.get({url:t},((t,s,i)=>e(i)))}))}runScript(t,e){return new Promise((s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=e&&e.timeout?e.timeout:o;const[r,a]=i.split("@"),n={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":r,Accept:"*/*"},policy:"DIRECT",timeout:o};this.post(n,((t,e,i)=>s(i)))})).catch((t=>this.logErr(t)))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),o=JSON.stringify(this.data);s?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(e,o):this.fs.writeFileSync(t,o)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return s;return o}lodash_set(t,e,s){return Object(t)!==t||(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce(((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{}),t)[e[e.length-1]]=s),t}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),o=s?this.getval(s):"";if(o)try{const t=JSON.parse(o);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(e),r=this.getval(i),a=i?"null"===r?null:r||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,o,t),s=this.setval(JSON.stringify(e),i)}catch(e){const r={};this.lodash_set(r,o,t),s=this.setval(JSON.stringify(r),i)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.cookie&&void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar)))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",((t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}})).then((t=>{const{statusCode:i,statusCode:o,headers:r,rawBody:a}=t,n=s.decode(a,this.encoding);e(null,{status:i,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:i,response:o}=t;e(i,o,o&&s.decode(o.rawBody,this.encoding))}));break}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let i=require("iconv-lite");this.initGotEnv(t);const{url:o,...r}=t;this.got[s](o,r).then((t=>{const{statusCode:s,statusCode:o,headers:r,rawBody:a}=t,n=i.decode(a,this.encoding);e(null,{status:s,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:s,response:o}=t;e(s,o,o&&i.decode(o.rawBody,this.encoding))}));break}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}queryStr(t){let e="";for(const s in t){let i=t[s];null!=i&&""!==i&&("object"==typeof i&&(i=JSON.stringify(i)),e+=`${s}=${i}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",i="",o={}){const r=t=>{const{$open:e,$copy:s,$media:i,$mediaMime:o}=t;switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{const r={};let a=t.openUrl||t.url||t["open-url"]||e;a&&Object.assign(r,{action:"open-url",url:a});let n=t["update-pasteboard"]||t.updatePasteboard||s;if(n&&Object.assign(r,{action:"clipboard",text:n}),i){let t,e,s;if(i.startsWith("http"))t=i;else if(i.startsWith("data:")){const[t]=i.split(";"),[,o]=i.split(",");e=o,s=t.replace("data:","")}else{e=i,s=(t=>{const e={JVBERi0:"application/pdf",R0lGODdh:"image/gif",R0lGODlh:"image/gif",iVBORw0KGgo:"image/png","/9j/":"image/jpg"};for(var s in e)if(0===t.indexOf(s))return e[s];return null})(i)}Object.assign(r,{"media-url":t,"media-base64":e,"media-base64-mime":o??s})}return Object.assign(r,{"auto-dismiss":t["auto-dismiss"],sound:t.sound}),r}case"Loon":{const s={};let o=t.openUrl||t.url||t["open-url"]||e;o&&Object.assign(s,{openUrl:o});let r=t.mediaUrl||t["media-url"];return i?.startsWith("http")&&(r=i),r&&Object.assign(s,{mediaUrl:r}),console.log(JSON.stringify(s)),s}case"Quantumult X":{const o={};let r=t["open-url"]||t.url||t.openUrl||e;r&&Object.assign(o,{"open-url":r});let a=t["media-url"]||t.mediaUrl;i?.startsWith("http")&&(a=i),a&&Object.assign(o,{"media-url":a});let n=t["update-pasteboard"]||t.updatePasteboard||s;return n&&Object.assign(o,{"update-pasteboard":n}),console.log(JSON.stringify(o)),o}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,i,r(o));break;case"Quantumult X":$notify(e,s,i,r(o));break;case"Node.js":break}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}debug(...t){this.logLevels[this.logLevel]<=this.logLevels.debug&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.debug}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}info(...t){this.logLevels[this.logLevel]<=this.logLevels.info&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.info}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}warn(...t){this.logLevels[this.logLevel]<=this.logLevels.warn&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.warn}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}error(...t){this.logLevels[this.logLevel]<=this.logLevels.error&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.error}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.map((t=>t??String(t))).join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,e,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,e,void 0!==t.message?t.message:t,t.stack);break}}wait(t){return new Promise((e=>setTimeout(e,t)))}done(t={}){const e=((new Date).getTime()-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${e} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 198 | -------------------------------------------------------------------------------- /Test/import/index.min.js: -------------------------------------------------------------------------------- 1 | async function importRemoteUtils(n,t,i,r){const u=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global}();if($.isNode()){if(r){$.debug(`【${i}】使用 'require' 导入模块 ${r}`);try{const n=require(r);$[i]=n;return}catch(o){$.error(`【${i}】导入模块 ${r} 失败, 请检查模块名或检查是否安装该依赖...`)}}else if($.debug(`【${i}】没有传入模块名称, 不使用 'require' 导入`),u[i]){$.debug(`【${i}】环境自带库, 已加载成功 🎉`);$[i]=u[i];return}!$[i]||$.debug(`【${i}】使用远程加载...`)}$.debug(`【${i}】正在从远程拉取脚本: ${n}`);const f=$.getval(`${i}.js`),e=n=>{eval(n),$[i]=t?eval(t)():u[i],!$[i]||$.debug(`【${i}】加载成功 🎉`)};f?($.debug(`【${i}】缓存存在, 尝试加载...`),e(f)):await $.http.get({url:n,timeout:2e3}).then(n=>{var t=n.body;e(t);$.setval(t,`${i}.js`);$.debug(`【${i}】已存入缓存 🎉`)}).catch(()=>Promise.reject(new Error(`【${i}】远程拉取失败, 请检查网络...`)))} -------------------------------------------------------------------------------- /Test/import/test.js: -------------------------------------------------------------------------------- 1 | const $ = new Env('远程拉取脚本', { 2 | logLevel: 'debug' 3 | }) 4 | !(async () => { 5 | await importRemoteUtils('https://cdn.jsdelivr.net/npm/qs@6.12.1/dist/qs.min.js', '', 'Qs', 'qs') 6 | const url = new URL('https://www.google.com/search?q=javascript&oq=javascript&aqs=chrome..69i57j0i22i30l9.2213j0j7&sourceid=chrome&ie=UTF-8') 7 | console.log(url.searchParams) 8 | const _parse = $.Qs.parse(url.search, { ignoreQueryPrefix: true }) 9 | console.log($.toStr(_parse)) 10 | await importRemoteUtils('https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js', '', 'dayjs', 'dayjs') 11 | console.log($.dayjs().format('YYYY-MM-DD HH:mm:ss')) 12 | await importRemoteUtils('https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.2.0/crypto-js.min.js', '', 'CryptoJS', 'crypto-js') 13 | const encrypted = $.CryptoJS.AES.encrypt('my message', 'Secret Passphrase').toString() 14 | console.log(encrypted) 15 | await importRemoteUtils('https://raw.githubusercontent.com/Yuheng0101/X/main/Utils/Buffer.min.js', '', 'Buffer') 16 | const _base64 = Buffer.from('hello world').toString('base64') 17 | console.log(_base64) 18 | await importRemoteUtils('https://cdn.jsdelivr.net/gh/Yuheng0101/X@main/Utils/JSEncrypt.min.js', 'loadJSEncrypt', 'RSA') 19 | console.log($.RSA) 20 | })() 21 | .catch((e) => $.logErr(e)) 22 | .finally(() => $.done()) 23 | async function importRemoteUtils(url, functionName, scriptName, moduleName) { 24 | const _global = (function () { 25 | if (typeof globalThis !== 'undefined') return globalThis 26 | return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global 27 | })() 28 | if ($.isNode()) { 29 | if (!moduleName) { 30 | $.debug(`【${scriptName}】没有传入模块名称, 不使用 'require' 导入`) 31 | if (_global[scriptName]) { 32 | $.debug(`【${scriptName}】环境自带库, 已加载成功 🎉`) 33 | $[scriptName] = _global[scriptName] 34 | return 35 | } 36 | } else { 37 | $.debug(`【${scriptName}】使用 'require' 导入模块 ${moduleName}`) 38 | try { 39 | const _module = require(moduleName) 40 | $[scriptName] = _module 41 | return 42 | } catch (e) { 43 | $.error(`【${scriptName}】导入模块 ${moduleName} 失败, 请检查模块名或检查是否安装该依赖...`) 44 | } 45 | } 46 | if (!!$[scriptName]) { 47 | $.debug(`【${scriptName}】使用远程加载...`) 48 | } 49 | } 50 | $.debug(`【${scriptName}】正在从远程拉取脚本: ${url}`) 51 | const _data = $.getval(`${scriptName}.js`) 52 | const _handler = (code) => { 53 | eval(code) 54 | if (!!functionName) { 55 | $[scriptName] = eval(functionName)() 56 | } else { 57 | $[scriptName] = _global[scriptName] 58 | } 59 | if (!!$[scriptName]) { 60 | $.debug(`【${scriptName}】加载成功 🎉`) 61 | } 62 | } 63 | if (!!_data) { 64 | $.debug(`【${scriptName}】缓存存在, 尝试加载...`) 65 | _handler(_data) 66 | } else { 67 | await $.http 68 | .get({ url, timeout: 2e3 }) 69 | .then((res) => { 70 | var code = res.body 71 | _handler(code) 72 | $.setval(code, `${scriptName}.js`) 73 | $.debug(`【${scriptName}】已存入缓存 🎉`) 74 | }) 75 | .catch((e) => { 76 | return Promise.reject(new Error(`【${scriptName}】远程拉取失败, 请检查网络...`)) 77 | }) 78 | } 79 | } 80 | // prettier-ignore 81 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;"POST"===e&&(s=this.post);const i=new Promise(((e,i)=>{s.call(this,t,((t,s,o)=>{t?i(t):e(s)}))}));return t.timeout?((t,e=1e3)=>Promise.race([t,new Promise(((t,s)=>{setTimeout((()=>{s(new Error("请求超时"))}),e)}))]))(i,t.timeout):i}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null,...s){try{return JSON.stringify(t,...s)}catch{return e}}getjson(t,e){let s=e;if(this.getdata(t))try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise((e=>{this.get({url:t},((t,s,i)=>e(i)))}))}runScript(t,e){return new Promise((s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=e&&e.timeout?e.timeout:o;const[r,a]=i.split("@"),n={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":r,Accept:"*/*"},policy:"DIRECT",timeout:o};this.post(n,((t,e,i)=>s(i)))})).catch((t=>this.logErr(t)))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),o=JSON.stringify(this.data);s?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(e,o):this.fs.writeFileSync(t,o)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return s;return o}lodash_set(t,e,s){return Object(t)!==t||(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce(((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{}),t)[e[e.length-1]]=s),t}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),o=s?this.getval(s):"";if(o)try{const t=JSON.parse(o);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(e),r=this.getval(i),a=i?"null"===r?null:r||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,o,t),s=this.setval(JSON.stringify(e),i)}catch(e){const r={};this.lodash_set(r,o,t),s=this.setval(JSON.stringify(r),i)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.cookie&&void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar)))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",((t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}})).then((t=>{const{statusCode:i,statusCode:o,headers:r,rawBody:a}=t,n=s.decode(a,this.encoding);e(null,{status:i,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:i,response:o}=t;e(i,o,o&&s.decode(o.rawBody,this.encoding))}));break}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let i=require("iconv-lite");this.initGotEnv(t);const{url:o,...r}=t;this.got[s](o,r).then((t=>{const{statusCode:s,statusCode:o,headers:r,rawBody:a}=t,n=i.decode(a,this.encoding);e(null,{status:s,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:s,response:o}=t;e(s,o,o&&i.decode(o.rawBody,this.encoding))}));break}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}queryStr(t){let e="";for(const s in t){let i=t[s];null!=i&&""!==i&&("object"==typeof i&&(i=JSON.stringify(i)),e+=`${s}=${i}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",i="",o={}){const r=t=>{const{$open:e,$copy:s,$media:i,$mediaMime:o}=t;switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{const r={};let a=t.openUrl||t.url||t["open-url"]||e;a&&Object.assign(r,{action:"open-url",url:a});let n=t["update-pasteboard"]||t.updatePasteboard||s;if(n&&Object.assign(r,{action:"clipboard",text:n}),i){let t,e,s;if(i.startsWith("http"))t=i;else if(i.startsWith("data:")){const[t]=i.split(";"),[,o]=i.split(",");e=o,s=t.replace("data:","")}else{e=i,s=(t=>{const e={JVBERi0:"application/pdf",R0lGODdh:"image/gif",R0lGODlh:"image/gif",iVBORw0KGgo:"image/png","/9j/":"image/jpg"};for(var s in e)if(0===t.indexOf(s))return e[s];return null})(i)}Object.assign(r,{"media-url":t,"media-base64":e,"media-base64-mime":o??s})}return Object.assign(r,{"auto-dismiss":t["auto-dismiss"],sound:t.sound}),r}case"Loon":{const s={};let o=t.openUrl||t.url||t["open-url"]||e;o&&Object.assign(s,{openUrl:o});let r=t.mediaUrl||t["media-url"];return i?.startsWith("http")&&(r=i),r&&Object.assign(s,{mediaUrl:r}),console.log(JSON.stringify(s)),s}case"Quantumult X":{const o={};let r=t["open-url"]||t.url||t.openUrl||e;r&&Object.assign(o,{"open-url":r});let a=t["media-url"]||t.mediaUrl;i?.startsWith("http")&&(a=i),a&&Object.assign(o,{"media-url":a});let n=t["update-pasteboard"]||t.updatePasteboard||s;return n&&Object.assign(o,{"update-pasteboard":n}),console.log(JSON.stringify(o)),o}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,i,r(o));break;case"Quantumult X":$notify(e,s,i,r(o));break;case"Node.js":break}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}debug(...t){this.logLevels[this.logLevel]<=this.logLevels.debug&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.debug}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}info(...t){this.logLevels[this.logLevel]<=this.logLevels.info&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.info}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}warn(...t){this.logLevels[this.logLevel]<=this.logLevels.warn&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.warn}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}error(...t){this.logLevels[this.logLevel]<=this.logLevels.error&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.error}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.map((t=>t??String(t))).join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,e,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,e,void 0!==t.message?t.message:t,t.stack);break}}wait(t){return new Promise((e=>setTimeout(e,t)))}done(t={}){const e=((new Date).getTime()-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${e} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} 82 | -------------------------------------------------------------------------------- /Utils/Buffer.min.js: -------------------------------------------------------------------------------- 1 | function loadBuffer(){function t(r,e,n){function i(o,u){if(!e[o]){if(!r[o]){var s="function"==typeof require&&require;if(!u&&s)return s(o,!0);if(f)return f(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var a=e[o]={exports:{}};r[o][0].call(a.exports,function(t){var e=r[o][1][t];return i(e||t)},a,a.exports,t,r,e,n)}return e[o].exports}let o={};for(var f="function"==typeof require&&require,u=0;u0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");-1===e&&(e=r);var n=e===r?0:4-e%4;return[e,n]}function i(t){var r=n(t),e=r[0],i=r[1];return 3*(e+i)/4-i}function o(t,r,e){return 3*(r+e)/4-e}function f(t){var r,e,i=n(t),f=i[0],u=i[1],s=new p(o(t,f,u)),h=0,a=u>0?f-4:f;for(e=0;e>16&255,s[h++]=r>>8&255,s[h++]=255&r;return 2===u&&(r=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[h++]=255&r),1===u&&(r=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[h++]=r>>8&255,s[h++]=255&r),s}function u(t){return a[t>>18&63]+a[t>>12&63]+a[t>>6&63]+a[63&t]}function s(t,r,e){for(var n,i=[],o=r;ou?u:f+o));return 1===n?(r=t[e-1],i.push(a[r>>2]+a[r<<4&63]+"==")):2===n&&(r=(t[e-2]<<8)+t[e-1],i.push(a[r>>10]+a[r>>4&63]+a[r<<2&63]+"=")),i.join("")}e.byteLength=i,e.toByteArray=f,e.fromByteArray=h;for(var a=[],c=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,g=l.length;yG)throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=new Uint8Array(t);return r.__proto__=i.prototype,r}function i(t,r,e){if("number"==typeof t){if("string"==typeof r)throw new TypeError('The "string" argument must be of type string. Received type number');return s(t)}return o(t,r,e)}function o(t,r,e){if("string"==typeof t)return h(t,r);if(ArrayBuffer.isView(t))return a(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return c(t,r,e);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return i.from(n,r,e);var o=p(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),r,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t,r,e){return f(t),t<=0?n(t):void 0!==r?"string"==typeof e?n(t).fill(r,e):n(t).fill(r):n(t)}function s(t){return f(t),n(t<0?0:0|l(t))}function h(t,r){if("string"==typeof r&&""!==r||(r="utf8"),!i.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var e=0|g(t,r),o=n(e),f=o.write(t,r);return f!==e&&(o=o.slice(0,f)),o}function a(t){for(var r=t.length<0?0:0|l(t.length),e=n(r),i=0;i=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,r){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var e=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===e)return 0;for(var o=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return Y(t).length;default:if(o)return n?-1:D(t).length;r=(""+r).toLowerCase(),o=!0}}function w(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if(e>>>=0,r>>>=0,e<=r)return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,r,e);case"utf8":case"utf-8":return I(this,r,e);case"ascii":return C(this,r,e);case"latin1":case"binary":return L(this,r,e);case"base64":return T(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function v(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,X(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=i.from(r,n)),i.isBuffer(r))return 0===r.length?-1:b(t,r,e,n,o);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):b(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function b(t,r,e,n,i){function o(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}var f,u=1,s=t.length,h=r.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,s/=2,h/=2,e/=2}if(i){var a=-1;for(f=e;fs&&(e=s-h),f=e;f>=0;f--){for(var c=!0,p=0;pi&&(n=i)):n=i;var o=r.length;n>o/2&&(n=o/2);for(var f=0;f239?4:h>223?3:h>191?2:1;if(i+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:o=t[i+1],128==(192&o)&&(s=(31&h)<<6|63&o,s>127&&(a=s));break;case 3:o=t[i+1],f=t[i+2],128==(192&o)&&128==(192&f)&&(s=(15&h)<<12|(63&o)<<6|63&f,s>2047&&(s<55296||s>57343)&&(a=s));break;case 4:o=t[i+1],f=t[i+2],u=t[i+3],128==(192&o)&&128==(192&f)&&128==(192&u)&&(s=(15&h)<<18|(63&o)<<12|(63&f)<<6|63&u,s>65535&&s<1114112&&(a=s))}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return S(n)}function S(t){var r=t.length;if(r<=H)return String.fromCharCode.apply(String,t);for(var e="",n=0;nn)&&(e=n);for(var i="",o=r;oe)throw new RangeError("Trying to access beyond buffer length")}function O(t,r,e,n,o,f){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||rt.length)throw new RangeError("Index out of range")}function k(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function N(t,r,e,n,i){return r=+r,e>>>=0,i||k(t,r,e,4,3.4028234663852886e38,-3.4028234663852886e38),Z.write(t,r,e,n,23,4),e+4}function P(t,r,e,n,i){return r=+r,e>>>=0,i||k(t,r,e,8,1.7976931348623157e308,-1.7976931348623157e308),Z.write(t,r,e,n,52,8),e+8}function j(t){if(t=t.split("=")[0],t=t.trim().replace(K,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],f=0;f55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function q(t){for(var r=[],e=0;e>8,i=e%256,o.push(i),o.push(n);return o}function Y(t){return J.toByteArray(j(t))}function V(t,r,e,n){for(var i=0;i=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function W(t,r){return t instanceof r||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===r.name}function X(t){return t!=t}var J=t("base64-js"),Z=t("ieee754");e.Buffer=i,e.SlowBuffer=y,e.INSPECT_MAX_BYTES=50;var G=2147483647;e.kMaxLength=G,i.TYPED_ARRAY_SUPPORT=r(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,r,e){return o(t,r,e)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,r,e){return u(t,r,e)},i.allocUnsafe=function(t){return s(t)},i.allocUnsafeSlow=function(t){return s(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,r){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),W(r,Uint8Array)&&(r=i.from(r,r.offset,r.byteLength)),!i.isBuffer(t)||!i.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var e=t.length,n=r.length,o=0,f=Math.min(e,n);or&&(t+=" ... "),""},i.prototype.compare=function(t,r,e,n,o){if(W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(r>>>=0,e>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var f=o-n,u=e-r,s=Math.min(f,u),h=this.slice(n,o),a=t.slice(r,e),c=0;c>>=0,isFinite(e)?(e>>>=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return m(this,t,r,e);case"utf8":case"utf-8":return E(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return B(this,t,r,e);case"base64":return U(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var H=4096;i.prototype.slice=function(t,r){var e=this.length;t=~~t,r=void 0===r?e:~~r,t<0?(t+=e,t<0&&(t=0)):t>e&&(t=e),r<0?(r+=e,r<0&&(r=0)):r>e&&(r=e),r>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},i.prototype.readUInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,r){return t>>>=0,r||x(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*r)),n},i.prototype.readIntBE=function(t,r,e){t>>>=0,r>>>=0,e||x(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o},i.prototype.readInt8=function(t,r){return t>>>=0,r||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt16BE=function(t,r){t>>>=0,r||x(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},i.prototype.readInt32LE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,r){return t>>>=0,r||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,r){return t>>>=0,r||x(t,4,this.length),Z.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,r){return t>>>=0,r||x(t,4,this.length),Z.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,r){return t>>>=0,r||x(t,8,this.length),Z.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,r){return t>>>=0,r||x(t,8,this.length),Z.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r>>>=0,e>>>=0,!n){var i=Math.pow(2,8*e)-1;O(this,t,r,e,i,0)}var o=1,f=0;for(this[r]=255&t;++f>>=0,e>>>=0,!n){var i=Math.pow(2,8*e)-1;O(this,t,r,e,i,0)}var o=e-1,f=1;for(this[r+o]=255&t;--o>=0&&(f*=256);)this[r+o]=t/f&255;return r+e},i.prototype.writeUInt8=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,1,255,0),this[r]=255&t,r+1},i.prototype.writeUInt16LE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,2,65535,0),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeUInt16BE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeUInt32LE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t,r+4},i.prototype.writeUInt32BE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);O(this,t,r,e,i-1,-i)}var o=0,f=1,u=0;for(this[r]=255&t;++o>0)-u&255;return r+e},i.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r>>>=0,!n){var i=Math.pow(2,8*e-1);O(this,t,r,e,i-1,-i)}var o=e-1,f=1,u=0;for(this[r+o]=255&t;--o>=0&&(f*=256);)t<0&&0===u&&0!==this[r+o+1]&&(u=1),this[r+o]=(t/f>>0)-u&255;return r+e},i.prototype.writeInt8=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=255&t,r+1},i.prototype.writeInt16LE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,2,32767,-32768),this[r]=255&t,this[r+1]=t>>>8,r+2},i.prototype.writeInt16BE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=255&t,r+2},i.prototype.writeInt32LE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,4,2147483647,-2147483648),this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},i.prototype.writeInt32BE=function(t,r,e){return t=+t,r>>>=0,e||O(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t,r+4},i.prototype.writeFloatLE=function(t,r,e){return N(this,t,r,!0,e)},i.prototype.writeFloatBE=function(t,r,e){return N(this,t,r,!1,e)},i.prototype.writeDoubleLE=function(t,r,e){return P(this,t,r,!0,e)},i.prototype.writeDoubleBE=function(t,r,e){return P(this,t,r,!1,e)},i.prototype.copy=function(t,r,e,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r=0;--f)t[f+r]=this[f+e];else Uint8Array.prototype.set.call(t,this.subarray(e,n),r);return o},i.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(r<0||this.length>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(f=r;f>1,a=-7,c=e?i-1:0,p=e?-1:1,l=t[r+c];for(c+=p,o=l&(1<<-a)-1,l>>=-a,a+=u;a>0;o=256*o+t[r+c],c+=p,a-=8);for(f=o&(1<<-a)-1,o>>=-a,a+=n;a>0;f=256*f+t[r+c],c+=p,a-=8);if(0===o)o=1-h;else{if(o===s)return f?NaN:1/0*(l?-1:1);f+=Math.pow(2,n),o-=h}return(l?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,r,e,n,i,o){var f,u,s,h=8*o-i-1,a=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,y=n?1:-1,g=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,f=a):(f=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-f))<1&&(f--,s*=2),r+=f+c>=1?p/s:p*Math.pow(2,1-c),r*s>=2&&(f++,s/=2),f+c>=a?(u=0,f=a):f+c>=1?(u=(r*s-1)*Math.pow(2,i),f+=c):(u=r*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[e+l]=255&u,l+=y,u/=256,i-=8);for(f=f<0;t[e+l]=255&f,l+=y,f/=256,h-=8);t[e+l-y]|=128*g}},{}]};return t(r,{},[2]).Buffer} -------------------------------------------------------------------------------- /Utils/dayjs.js: -------------------------------------------------------------------------------- 1 | function loadDayjs(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)