├── .DS_Store ├── .github └── workflows │ └── main.yml ├── .idea ├── .gitignore ├── jd.iml ├── modules.xml └── vcs.xml ├── JD_extra_cookie.js ├── JS_USER_AGENTS.js ├── README.md ├── USER_AGENTS.js ├── code ├── cash.json └── zoo.txt ├── format_share_jd_code.js ├── getJDCookie.js ├── jdCookie.js ├── jdDreamFactoryShareCodes.js ├── jdFactoryShareCodes.js ├── jdFruitShareCodes.js ├── jdJxncShareCodes.js ├── jdJxncTokens.js ├── jdPetShareCodes.js ├── jdPlantBeanShareCodes.js ├── jd_Elecsport.js ├── jd_SplitRedPacket.js ├── jd_bean_change.js ├── jd_bean_home.js ├── jd_bean_sign.js ├── jd_beauty.js ├── jd_blueCoin.js ├── jd_bookshop.js ├── jd_car.js ├── jd_cash.js ├── jd_cashHelp.py ├── jd_cfd.js ├── jd_cfdtx.js ├── jd_ckcheck.js ├── jd_club_lottery.js ├── jd_crazyJoy.js ├── jd_crazy_joy_bonus.js ├── jd_crazy_joy_coin.js ├── jd_daily_egg.js ├── jd_daily_lottery.js ├── jd_ddnc_farmpark.js ├── jd_deleteCoupon.js ├── jd_djfruit.js ├── jd_dreamFactory.js ├── jd_dreamFactorytuan.js ├── jd_family.js ├── jd_fruit.js ├── jd_get_share_code.js ├── jd_gold_creator.js ├── jd_hby_lottery.js ├── jd_health.js ├── jd_health_collect.js ├── jd_hwsx.js ├── jd_jdfactory.js ├── jd_jdzz.js ├── jd_jin_tie.js ├── jd_joy.js ├── jd_joy_feedPets.js ├── jd_joy_help.js ├── jd_joy_reward.js ├── jd_joy_run.js ├── jd_joy_steal.js ├── jd_jxmc.js ├── jd_jxnc.js ├── jd_kanjia.js ├── jd_kd.js ├── jd_live.js ├── jd_long_half_redrain.js ├── jd_lotteryMachine.js ├── jd_lsj.js ├── jd_market_lottery.js ├── jd_mohe.js ├── jd_moneyTree.js ├── jd_ms.js ├── jd_necklace.js ├── jd_pet.js ├── jd_pigPet.js ├── jd_pk.js ├── jd_plantBean.js ├── jd_ppdz.js ├── jd_priceProtect.js ├── jd_qjd.py ├── jd_qmwxj.js ├── jd_qqxing.js ├── jd_rankingList.js ├── jd_redPacket.js ├── jd_sgmh.js ├── jd_shop.js ├── jd_speed.js ├── jd_speed_redpocke.js ├── jd_speed_sign.js ├── jd_star_shop.js ├── jd_superMarket.js ├── jd_syj.js ├── jd_try.js ├── jd_tyt.js ├── jd_unsubscribe.js ├── jd_wsdlb.js ├── jd_yqyl.js ├── jd_zjb.js ├── jd_zjd.py ├── jd_zooOpencard12.js ├── jd_zooSupershophf.js ├── jddjfruitcode.js ├── jx_cfdtx.js ├── list.txt ├── png-js.js ├── sendNotify.js └── sqyqm.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/colakele/jd/80a801817621c2a583172fa2a4c0912e1d57f212/.DS_Store -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | # delete this item if you don't want to trigger this workflow when modify this repo 4 | branches: master 5 | schedule: 6 | # * is a special character in YAML so you have to quote this string 7 | # UTC 17:00 -> CST (China) 1:00, see https://datetime360.com/cn/utc-cst-china-time/ 8 | - cron: '10 * * * *' 9 | name: Mirror GitHub Auto Queried Repos to Gitee 10 | jobs: 11 | run: 12 | name: Sync-GitHub-to-Gitee 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Mirror the Github repos to Gitee. 16 | uses: Yikun/hub-mirror-action@master 17 | with: 18 | src: github/colakele 19 | dst: gitee/colakelejs 20 | dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} 21 | dst_token: ${{ secrets.GITEE_TOKEN }} 22 | force_update: true 23 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | -------------------------------------------------------------------------------- /.idea/jd.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /JD_extra_cookie.js: -------------------------------------------------------------------------------- 1 | /* 2 | 感谢github@dompling的PR 3 | 4 | Author: 2Ya 5 | 6 | Github: https://github.com/dompling 7 | 8 | =================== 9 | 特别说明: 10 | 1.获取多个京东cookie的脚本,不和NobyDa的京东cookie冲突。注:如与NobyDa的京东cookie重复,建议在BoxJs处删除重复的cookie 11 | =================== 12 | =================== 13 | 使用方式:在代理软件配置好下方配置后,复制 https://home.m.jd.com/myJd/newhome.action 到浏览器打开 ,在个人中心自动获取 cookie, 14 | 若弹出成功则正常使用。否则继续再此页面继续刷新一下试试。 15 | 16 | 注:建议通过脚本去获取cookie,若要在BoxJs处手动修改,请按照JSON格式修改(注:可使用此JSON校验 https://www.bejson.com/json/format) 17 | 示例:[{"userName":"jd_xxx","cookie":"pt_key=AAJ;pt_pin=jd_xxx;"},{"userName":"jd_66","cookie":"pt_key=AAJ;pt_pin=jd_66;"}] 18 | =================== 19 | new Env('获取多账号京东Cookie');//此处忽略即可,为自动生成iOS端软件配置文件所需 20 | =================== 21 | [MITM] 22 | hostname = me-api.jd.com 23 | 24 | ===================Quantumult X===================== 25 | [rewrite_local] 26 | # 获取多账号京东Cookie 27 | https:\/\/me-api\.jd\.com\/user_new\/info\/GetJDUserInfoUnion url script-request-header JD_extra_cookie.js 28 | 29 | ===================Loon=================== 30 | [Script] 31 | http-request https:\/\/me-api\.jd\.com\/user_new\/info\/GetJDUserInfoUnion script-path=JD_extra_cookie.js, tag=获取多账号京东Cookie 32 | 33 | ===================Surge=================== 34 | [Script] 35 | 获取多账号京东Cookie = type=http-request,pattern=^https:\/\/me-api\.jd\.com\/user_new\/info\/GetJDUserInfoUnion,requires-body=1,max-size=0,script-path=JD_extra_cookie.js,script-update-interval=0 36 | */ 37 | 38 | const APIKey = "CookiesJD"; 39 | $ = new API(APIKey, true); 40 | const CacheKey = `#${APIKey}`; 41 | if ($request) GetCookie(); 42 | 43 | function getCache() { 44 | var cache = $.read(CacheKey) || "[]"; 45 | $.log(cache); 46 | return JSON.parse(cache); 47 | } 48 | 49 | function GetCookie() { 50 | try { 51 | if ($request.headers && $request.url.indexOf("GetJDUserInfoUnion") > -1) { 52 | var CV = $request.headers["Cookie"] || $request.headers["cookie"]; 53 | if (CV.match(/(pt_key=.+?pt_pin=|pt_pin=.+?pt_key=)/)) { 54 | var CookieValue = CV.match(/pt_key=.+?;/) + CV.match(/pt_pin=.+?;/); 55 | var UserName = CookieValue.match(/pt_pin=([^; ]+)(?=;?)/)[1]; 56 | var DecodeName = decodeURIComponent(UserName); 57 | var CookiesData = getCache(); 58 | var updateCookiesData = [...CookiesData]; 59 | var updateIndex; 60 | var CookieName = "【账号】"; 61 | var updateCodkie = CookiesData.find((item, index) => { 62 | var ck = item.cookie; 63 | var Account = ck 64 | ? ck.match(/pt_pin=.+?;/) 65 | ? ck.match(/pt_pin=([^; ]+)(?=;?)/)[1] 66 | : null 67 | : null; 68 | const verify = UserName === Account; 69 | if (verify) { 70 | updateIndex = index; 71 | } 72 | return verify; 73 | }); 74 | var tipPrefix = ""; 75 | if (updateCodkie) { 76 | updateCookiesData[updateIndex].cookie = CookieValue; 77 | CookieName = `【账号${updateIndex + 1}】`; 78 | tipPrefix = "更新京东"; 79 | } else { 80 | updateCookiesData.push({ 81 | userName: DecodeName, 82 | cookie: CookieValue, 83 | }); 84 | CookieName = "【账号" + updateCookiesData.length + "】"; 85 | tipPrefix = "首次写入京东"; 86 | } 87 | const cacheValue = JSON.stringify(updateCookiesData, null, "\t"); 88 | $.write(cacheValue, CacheKey); 89 | $.notify( 90 | "用户名: " + DecodeName, 91 | "", 92 | tipPrefix + CookieName + "Cookie成功 🎉" 93 | ); 94 | } else { 95 | $.notify("写入京东Cookie失败", "", "请查看脚本内说明, 登录网页获取 ‼️"); 96 | } 97 | $.done(); 98 | return; 99 | } else { 100 | $.notify("写入京东Cookie失败", "", "请检查匹配URL或配置内脚本类型 ‼️"); 101 | } 102 | } catch (eor) { 103 | $.write("", CacheKey); 104 | $.notify("写入京东Cookie失败", "", "已尝试清空历史Cookie, 请重试 ⚠️"); 105 | console.log( 106 | `\n写入京东Cookie出现错误 ‼️\n${JSON.stringify( 107 | eor 108 | )}\n\n${eor}\n\n${JSON.stringify($request.headers)}\n` 109 | ); 110 | } 111 | $.done(); 112 | } 113 | 114 | // prettier-ignore 115 | function ENV(){const isQX=typeof $task!=="undefined";const isLoon=typeof $loon!=="undefined";const isSurge=typeof $httpClient!=="undefined"&&!isLoon;const isJSBox=typeof require=="function"&&typeof $jsbox!="undefined";const isNode=typeof require=="function"&&!isJSBox;const isRequest=typeof $request!=="undefined";const isScriptable=typeof importModule!=="undefined";return{isQX,isLoon,isSurge,isNode,isJSBox,isRequest,isScriptable}} 116 | // prettier-ignore 117 | function HTTP(baseURL,defaultOptions={}){const{isQX,isLoon,isSurge,isScriptable,isNode}=ENV();const methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];function send(method,options){options=typeof options==="string"?{url:options}:options;options.url=baseURL?baseURL+options.url:options.url;options={...defaultOptions,...options};const timeout=options.timeout;const events={...{onRequest:()=>{},onResponse:(resp)=>resp,onTimeout:()=>{},},...options.events,};events.onRequest(method,options);let worker;if(isQX){worker=$task.fetch({method,...options})}else if(isLoon||isSurge||isNode){worker=new Promise((resolve,reject)=>{const request=isNode?require("request"):$httpClient;request[method.toLowerCase()](options,(err,response,body)=>{if(err)reject(err);else resolve({statusCode:response.status||response.statusCode,headers:response.headers,body,})})})}else if(isScriptable){const request=new Request(options.url);request.method=method;request.headers=options.headers;request.body=options.body;worker=new Promise((resolve,reject)=>{request.loadString().then((body)=>{resolve({statusCode:request.response.statusCode,headers:request.response.headers,body,})}).catch((err)=>reject(err))})}let timeoutid;const timer=timeout?new Promise((_,reject)=>{timeoutid=setTimeout(()=>{events.onTimeout();return reject(`${method}URL:${options.url}exceeds the timeout ${timeout}ms`)},timeout)}):null;return(timer?Promise.race([timer,worker]).then((res)=>{clearTimeout(timeoutid);return res}):worker).then((resp)=>events.onResponse(resp))}const http={};methods.forEach((method)=>(http[method.toLowerCase()]=(options)=>send(method,options)));return http} 118 | // prettier-ignore 119 | function API(name="untitled",debug=false){const{isQX,isLoon,isSurge,isNode,isJSBox,isScriptable}=ENV();return new(class{constructor(name,debug){this.name=name;this.debug=debug;this.http=HTTP();this.env=ENV();this.node=(()=>{if(isNode){const fs=require("fs");return{fs}}else{return null}})();this.initCache();const delay=(t,v)=>new Promise(function(resolve){setTimeout(resolve.bind(null,v),t)});Promise.prototype.delay=function(t){return this.then(function(v){return delay(t,v)})}}initCache(){if(isQX)this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}");if(isLoon||isSurge)this.cache=JSON.parse($persistentStore.read(this.name)||"{}");if(isNode){let fpath="root.json";if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err))}this.root={};fpath=`${this.name}.json`;if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err));this.cache={}}else{this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`))}}}persistCache(){const data=JSON.stringify(this.cache);if(isQX)$prefs.setValueForKey(data,this.name);if(isLoon||isSurge)$persistentStore.write(data,this.name);if(isNode){this.node.fs.writeFileSync(`${this.name}.json`,data,{flag:"w"},(err)=>console.log(err));this.node.fs.writeFileSync("root.json",JSON.stringify(this.root),{flag:"w"},(err)=>console.log(err))}}write(data,key){this.log(`SET ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.write(data,key)}if(isQX){return $prefs.setValueForKey(data,key)}if(isNode){this.root[key]=data}}else{this.cache[key]=data}this.persistCache()}read(key){this.log(`READ ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.read(key)}if(isQX){return $prefs.valueForKey(key)}if(isNode){return this.root[key]}}else{return this.cache[key]}}delete(key){this.log(`DELETE ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){$persistentStore.write(null,key)}if(isQX){$prefs.removeValueForKey(key)}if(isNode){delete this.root[key]}}else{delete this.cache[key]}this.persistCache()}notify(title,subtitle="",content="",options={}){const openURL=options["open-url"];const mediaURL=options["media-url"];if(isQX)$notify(title,subtitle,content,options);if(isSurge){$notification.post(title,subtitle,content+`${mediaURL?"\n多媒体:"+mediaURL:""}`,{url:openURL})}if(isLoon){let opts={};if(openURL)opts["openUrl"]=openURL;if(mediaURL)opts["mediaUrl"]=mediaURL;if(JSON.stringify(opts)=="{}"){$notification.post(title,subtitle,content)}else{$notification.post(title,subtitle,content,opts)}}if(isNode||isScriptable){const content_=content+(openURL?`\n点击跳转:${openURL}`:"")+(mediaURL?`\n多媒体:${mediaURL}`:"");if(isJSBox){const push=require("push");push.schedule({title:title,body:(subtitle?subtitle+"\n":"")+content_,})}else{console.log(`${title}\n${subtitle}\n${content_}\n\n`)}}}log(msg){if(this.debug)console.log(msg)}info(msg){console.log(msg)}error(msg){console.log("ERROR: "+msg)}wait(millisec){return new Promise((resolve)=>setTimeout(resolve,millisec))}done(value={}){if(isQX||isLoon||isSurge){$done(value)}else if(isNode&&!isJSBox){if(typeof $context!=="undefined"){$context.headers=value.headers;$context.statusCode=value.statusCode;$context.body=value.body}}}})(name,debug)} 120 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 可乐京东库 - JD Scripts All in one 2 | ## 欢迎一起更新维护,TG联系 3 | ## 免责声明 4 | 5 | 1. 此仓储脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 6 | 7 | 2. 由于此仓储脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 8 | 9 | 3. 请勿将此仓储脚本用于任何商业或非法目的,若违反规定请自行对此负责。 10 | 11 | 4. 此仓储脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 12 | 13 | 5. 本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 14 | 15 | 6. 如果任何单位或个人认为此仓储脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此仓储脚本。 16 | 17 | 7. 所有直接或间接使用、查看此仓储脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此仓储脚本,即视为您已接受此免责声明。 18 | 19 | 8. 此仓库中助力信息请自行修改!!!! 20 | 21 | 9. 此仓库中助力信息请自行修改!!!! 22 | 23 | 10. 此仓库中助力信息请自行修改!!!! 24 | 25 |
26 | 来源清单 27 | 28 | > 来源清单,同步更新,特别感谢这些大佬的付出 29 | 30 | * [@whyour](https://github.com/whyour) 31 | 32 | * [@NobyDa](https://github.com/NobyDa) 33 | 34 | * [@yangtingxiao](https://github.com/yangtingxiao/) 35 | 36 | * [@zooPanda](https://github.com/zooPanda) 37 | 38 | * [@chinnkarahoi](https://github.com/cchinnkarahoi) 39 | 40 | * [@longzhuzhu](https://github.com/longzhuzhu) 41 | 42 | * [@monk-coder](https://github.com/monk-coder) 43 | 44 | * [@lxk0301](https://github.com/lxk0301) 45 | 46 | * [@star261](https://github.com/star261) 47 | 48 | * [@panghu999](https://github.com/panghu999) 49 | 50 | * [@passerby-b](https://github.com/passerby-b) 51 |
52 | 53 | ## 其他链接 54 | 55 | * [可乐博客:colakele.com](https://colakele.com) 56 | 57 | * [TG频道:@colakelecom](https://t.me/colakelecom) 58 | -------------------------------------------------------------------------------- /USER_AGENTS.js: -------------------------------------------------------------------------------- 1 | const USER_AGENTS = [ 2 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 3 | "jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 4 | "jdapp;android;10.0.2;9;network/4g;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 5 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 6 | "jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; 16T Build/PKQ1.190616.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 7 | "jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 8 | "jdapp;iPhone;10.0.2;13.6;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 9 | "jdapp;iPhone;10.0.2;13.5;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 10 | "jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 11 | "jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 12 | "jdapp;iPhone;10.0.2;13.7;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 13 | "jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 14 | "jdapp;iPhone;10.0.2;13.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 15 | "jdapp;iPhone;10.0.2;13.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 16 | "jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 17 | "jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 18 | "jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36", 19 | "jdapp;iPhone;10.0.2;11.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", 20 | "jdapp;android;10.0.2;10;;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 21 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 22 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", 23 | "jdapp;android;10.0.2;9;network/wifi;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 24 | "jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; 16 X Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 25 | "jdapp;android;10.0.2;8.0.0;network/wifi;Mozilla/5.0 (Linux; Android 8.0.0; HTC U-3w Build/OPR6.170623.013; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 26 | "jdapp;iPhone;10.0.2;14.0.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 27 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 28 | "jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 29 | "jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 30 | "jdapp;iPhone;10.0.2;14.2;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 31 | "jdapp;android;10.0.2;8.1.0;network/wifi;Mozilla/5.0 (Linux; Android 8.1.0; MI 8 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 32 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; Redmi K20 Pro Premium Edition Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 33 | "jdapp;iPhone;10.0.2;14.3;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 34 | "jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 35 | "jdapp;android;10.0.2;11;network/wifi;Mozilla/5.0 (Linux; Android 11; Redmi K20 Pro Premium Edition Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", 36 | "jdapp;android;10.0.2;10;network/wifi;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 37 | "jdapp;iPhone;10.0.2;14.1;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 38 | ] 39 | /** 40 | * 生成随机数字 41 | * @param {number} min 最小值(包含) 42 | * @param {number} max 最大值(不包含) 43 | */ 44 | function randomNumber(min = 0, max = 100) { 45 | return Math.min(Math.floor(min + Math.random() * (max - min)), max); 46 | } 47 | const USER_AGENT = USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; 48 | 49 | module.exports = { 50 | USER_AGENT 51 | } 52 | -------------------------------------------------------------------------------- /code/cash.json: -------------------------------------------------------------------------------- 1 | { 2 | "code": 200, 3 | "data": [ 4 | "eU9Yab-wZ_gh8WaGmSBH0Q" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /code/zoo.txt: -------------------------------------------------------------------------------- 1 | sSKNX-MpqKOJsNvb8ceEZVZmTGy4zEMzMyeSFu9qyiAPcJg2fKyQzlXrXYNmiDs 2 | sSKNX-MpqKPS4rS-npPQDYOlFyDzCyhRYtxWZkNYIjNWBEuDByCGnQjA20ol0D6z 3 | -------------------------------------------------------------------------------- /format_share_jd_code.js: -------------------------------------------------------------------------------- 1 | 2 | const $ = new Env("从日志中获取互助码并格式化"); 3 | const notifyMsg = ``; 4 | const notify = $.isNode() ? require("./sendNotify") : ""; 5 | const fs = require("fs"); 6 | const path = require("path"); 7 | $.shareCodeObj = {}; 8 | $.exportStr = ""; 9 | 10 | let fsjd_notify_control = true 11 | 12 | if (!$.isNode()) { 13 | console.log("不是nodejs环境"); 14 | } else { 15 | if (process.env.FSJD_NOTIFY_CONTROL === "true") { 16 | fsjd_notify_control = false 17 | } 18 | 19 | let filePath = path.resolve(__dirname, "../log/export_sharecodes"); 20 | let readDir = fs.readdirSync(filePath).reverse(); 21 | let fileName; 22 | 23 | if (readDir && readDir.length > 0) { 24 | fileName = readDir[0]; 25 | } else { 26 | console.log("没有生成日志,请手动运行 bash export_sharecodes.sh"); 27 | } 28 | 29 | // 读取日志 30 | let file = path.resolve(__dirname, filePath, fileName); 31 | fs.readFile(file, "utf-8", function (err, data) { 32 | if (err) { 33 | console.error(err); 34 | } else { 35 | console.log("读取文件成功"); 36 | // console.log(data); 37 | // 按 互助码 分割 38 | let arr = data 39 | .split("\n") 40 | .map((item) => { 41 | if (item === "") { 42 | return "$&$"; 43 | } else { 44 | return item; 45 | } 46 | }) 47 | .join("") 48 | .split("$&$"); 49 | 50 | $.shareCodeObj.Bean = exportShareCodes(arr, "种豆得豆:"); 51 | $.shareCodeObj.Fruit = exportShareCodes(arr, "东东农场:"); 52 | $.shareCodeObj.Pet = exportShareCodes(arr, "东东萌宠:"); 53 | $.shareCodeObj.DreamFactory = exportShareCodes(arr, "京喜工厂:"); 54 | $.shareCodeObj.Jxnc = exportShareCodes(arr, "京喜农场:"); 55 | $.shareCodeObj.JdFactory = exportShareCodes(arr, "东东工厂:"); 56 | $.shareCodeObj.Joy = exportShareCodes(arr, "疯狂的JOY:"); 57 | $.shareCodeObj.Cash = exportShareCodes(arr, "签到领现金:"); 58 | $.shareCodeObj.Sgmh = exportShareCodes(arr, "闪购盲盒:"); 59 | $.shareCodeObj.Cfd = exportShareCodes(arr, "京喜财富岛:"); 60 | $.shareCodeObj.Kdsd = exportShareCodes(arr, "口袋书店:"); 61 | $.shareCodeObj.Jdcfd = exportShareCodes(arr, "京喜财富岛:"); 62 | $.shareCodeObj.Global = exportShareCodes(arr, "环球挑战赛:"); 63 | 64 | showFormatMsg($.shareCodeObj); 65 | 66 | } 67 | }); 68 | } 69 | 70 | // 通用格式化 71 | const exportShareCodes = (arr, zhName) => { 72 | const resShareCodeArr = []; 73 | arr && 74 | arr.forEach((item) => { 75 | if (item.startsWith(zhName)) { 76 | console.log(item); 77 | // 【 】 类型的分割 78 | let reg = /([:]|[:\s*]|[】])([A-Za-z0-9=\-_{}:"',]+)[\u3010]/g; 79 | // let reg = /)】\w+【京东/g; 80 | let resArr = item.match(reg); 81 | let itemSplits = item.split(/[】]|[:]/); 82 | // console.log(resArr); 83 | 84 | resArr && 85 | resArr.forEach((item) => { 86 | // console.log(item); 87 | resShareCodeArr.push(item.slice(1, -1)); 88 | }); 89 | resShareCodeArr.push(itemSplits[itemSplits.length - 1]); 90 | } 91 | }); 92 | return resShareCodeArr; 93 | }; 94 | 95 | function showFormatMsg(shareCodeObj) { 96 | console.log( 97 | `\n========== 【格式化互助码只留随机4-5个(一定有第一个)】 ==========` 98 | ); 99 | console.log(`\n提交机器人 @Turing Lab Bot\n`); 100 | console.log( 101 | `/submit_activity_codes bean ${getRandomArrayElements( 102 | shareCodeObj.Bean 103 | ).join("&")}\n` 104 | ); 105 | console.log( 106 | `/submit_activity_codes farm ${getRandomArrayElements( 107 | shareCodeObj.Fruit 108 | ).join("&")}\n` 109 | ); 110 | console.log( 111 | `/submit_activity_codes pet ${getRandomArrayElements(shareCodeObj.Pet).join( 112 | "&" 113 | )}\n` 114 | ); 115 | console.log( 116 | `/submit_activity_codes jxfactory ${getRandomArrayElements( 117 | shareCodeObj.DreamFactory 118 | ).join("&")}\n` 119 | ); 120 | console.log( 121 | `/submit_activity_codes ddfactory ${getRandomArrayElements( 122 | shareCodeObj.JdFactory 123 | ).join("&")}\n` 124 | ); 125 | // 临时活动 126 | console.log( 127 | `/submit_activity_codes sgmh ${getRandomArrayElements( 128 | shareCodeObj.Sgmh 129 | ).join("&")}\n` 130 | ); 131 | console.log( 132 | `/submit_activity_codes jxcfd ${getRandomArrayElements( 133 | shareCodeObj.Cfd 134 | ).join("&")}\n` 135 | ); 136 | 137 | console.log(`\n提交机器人 @Commit Code Bot\n`); 138 | console.log( 139 | `/jdcash ${getRandomArrayElements(shareCodeObj.Cash).join("&")}\n` 140 | ); 141 | console.log( 142 | `/jdcrazyjoy ${getRandomArrayElements(shareCodeObj.Joy).join("&")}\n` 143 | ); 144 | 145 | console.log(`\n========== 【格式化互助码for docker ==========`); 146 | formatShareCodesForLinux( 147 | shareCodeObj.Bean, 148 | "种豆得豆", 149 | "MyBean", 150 | "ForOtherBean" 151 | ); 152 | formatShareCodesForLinux( 153 | shareCodeObj.Fruit, 154 | "东东农场", 155 | "MyFruit", 156 | "ForOtherFruit" 157 | ); 158 | formatShareCodesForLinux( 159 | shareCodeObj.Pet, 160 | "东东萌宠", 161 | "MyPet", 162 | "ForOtherPet" 163 | ); 164 | formatShareCodesForLinux( 165 | shareCodeObj.Jxnc, 166 | "京喜农场", 167 | "MyJxnc", 168 | "ForOtherJxnc", 169 | "'" 170 | ); 171 | formatShareCodesForLinux( 172 | shareCodeObj.DreamFactory, 173 | "京喜工厂", 174 | "MyDreamFactory", 175 | "ForOtherDreamFactory" 176 | ); 177 | formatShareCodesForLinux( 178 | shareCodeObj.JdFactory, 179 | "东东工厂", 180 | "MyJdFactory", 181 | "ForOtherJdFactory" 182 | ); 183 | formatShareCodesForLinux( 184 | shareCodeObj.Cash, 185 | "签到领现金", 186 | "MyCash", 187 | "ForOtherCash" 188 | ); 189 | formatShareCodesForLinux( 190 | shareCodeObj.Joy, 191 | "crazy joy", 192 | "MyJoy", 193 | "ForOtherJoy" 194 | ); 195 | formatShareCodesForLinux( 196 | shareCodeObj.Sgmh, 197 | "闪购盲盒", 198 | "MySgmh", 199 | "ForOtherSgmh" 200 | ); 201 | formatShareCodesForLinux( 202 | shareCodeObj.Jdcfd, 203 | "京喜财富岛", 204 | "MyCfd", 205 | "ForOtherMyCfd" 206 | ); 207 | formatShareCodesForLinux( 208 | shareCodeObj.Global, 209 | "环球挑战赛", 210 | "MyGlobal", 211 | "ForOtherGlobal" 212 | ); 213 | } 214 | 215 | const formatShareCodesForLinux = ( 216 | arr = [], 217 | name = "", 218 | itemName = "", 219 | forOtherName = "", 220 | marks = '"' 221 | ) => { 222 | // My 系列 格式化 223 | $.exportStr += `# ${name}\n`; 224 | console.log(`# ${name}`); 225 | const nameArr = []; 226 | for (let i = 0; i < arr.length; i++) { 227 | const item = arr[i]; 228 | const log = `${itemName}${i + 1}=${marks}${item}${marks}`; 229 | $.exportStr += `${log}\n`; 230 | console.log(log); 231 | const name = "${" + itemName + (i + 1) + "}"; 232 | nameArr.push(name); 233 | } 234 | 235 | // ForOther 系列 格式化 236 | // 以 种豆得豆 个数 为准 循环 生成 other互助 补齐 没有 互助码的号 的互助 名额 237 | for (let m = 0; m < $.shareCodeObj.Bean.length; m++) { 238 | // for (let m = 0; m < nameArr.length; m++) { 239 | // const item = nameArr[m] 240 | // console.log( 241 | // `${forOtherName}${m + 1}='${nameArr 242 | // .filter(cell => cell !== item) 243 | // .join('@')}'` 244 | // ) 245 | const log = `${forOtherName}${m + 1}="${nameArr.join("@")}"`; 246 | $.exportStr += `${log}\n`; 247 | console.log(log); 248 | } 249 | }; 250 | 251 | // 随机区 数组中的 几个元素, 必有 第一个元素 252 | function getRandomArrayElements(arr = [], count = 4) { 253 | if (arr.length <= 5) { 254 | return arr; 255 | } else { 256 | let shuffled = arr.slice(0), 257 | i = arr.length, 258 | min = i - count, 259 | temp, 260 | index; 261 | while (i-- > min) { 262 | index = Math.floor((i + 1) * Math.random()); 263 | temp = shuffled[index]; 264 | shuffled[index] = shuffled[i]; 265 | shuffled[i] = temp; 266 | } 267 | const res = [arr[0], ...shuffled.slice(min)]; 268 | return [...new Set(res)]; 269 | } 270 | }; 271 | 272 | // prettier-ignore 273 | 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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 274 | -------------------------------------------------------------------------------- /getJDCookie.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 扫码获取京东cookie,此方式得到的cookie有效期为30天 3 | * 柠檬修复版 4 | */ 5 | const $ = new Env('扫码获取京东cookie'); 6 | const qrcode = require('qrcode-terminal'); 7 | let s_token, cookies, guid, lsid, lstoken, okl_token, token 8 | !(async () => { 9 | await loginEntrance(); 10 | await generateQrcode(); 11 | await getCookie(); 12 | })() 13 | .catch((e) => { 14 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') 15 | }) 16 | .finally(() => { 17 | // $.done(); 18 | }) 19 | 20 | 21 | function loginEntrance() { 22 | return new Promise((resolve) => { 23 | $.get(taskUrl(), async (err, resp, data) => { 24 | try { 25 | if (err) { 26 | console.log(`${JSON.stringify(err)}`) 27 | console.log(`${$.name} API请求失败,请检查网路重试`); 28 | } else { 29 | $.headers = resp.headers; 30 | $.data = JSON.parse(data); 31 | await formatSetCookies($.headers, $.data); 32 | } 33 | } catch (e) { 34 | $.logErr(e, resp) 35 | } finally { 36 | resolve(); 37 | } 38 | }) 39 | }) 40 | } 41 | 42 | function generateQrcode() { 43 | return new Promise((resolve) => { 44 | $.post(taskPostUrl(), (err, resp, data) => { 45 | try { 46 | if (err) { 47 | console.log(`${JSON.stringify(err)}`) 48 | console.log(`${$.name} API请求失败,请检查网路重试`); 49 | } else { 50 | $.stepsHeaders = resp.headers; 51 | data = JSON.parse(data); 52 | token = data['token']; 53 | // $.log('token', token) 54 | 55 | const setCookie = resp.headers['set-cookie'][0]; 56 | okl_token = setCookie.substring(setCookie.indexOf("=") + 1, setCookie.indexOf(";")) 57 | const url = 'https://plogin.m.jd.com/cgi-bin/m/tmauth?appid=300&client_type=m&token=' + token; 58 | qrcode.generate(url, {small: true}); // 输出二维码 59 | console.log("请打开 京东APP 扫码登录(二维码有效期为3分钟)"); 60 | console.log(`\n\n注:如扫描不到,请使用工具(例如在线二维码工具:https://cli.im)手动生成如下url二维码\n\n${url}\n\n`); 61 | } 62 | } catch (e) { 63 | $.logErr(e, resp) 64 | } finally { 65 | resolve(); 66 | } 67 | }) 68 | }) 69 | } 70 | 71 | function checkLogin() { 72 | return new Promise((resolve) => { 73 | const options = { 74 | url: `https://plogin.m.jd.com/cgi-bin/m/tmauthchecktoken?&token=${token}&ou_state=0&okl_token=${okl_token}`, 75 | body: `lang=chs&appid=300&source=wq_passport&returnurl=https://wqlogin2.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=//home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action`, 76 | headers: { 77 | 'Referer': `https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wqlogin2.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=//home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport`, 78 | 'Cookie': cookies, 79 | 'Connection': 'Keep-Alive', 80 | 'Content-Type': 'application/x-www-form-urlencoded; Charset=UTF-8', 81 | 'Accept': 'application/json, text/plain, */*', 82 | 'User-Agent': 'jdapp;android;10.0.5;11;0393465333165363-5333430323261366;network/wifi;model/M2102K1C;osVer/30;appBuild/88681;partner/lc001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; M2102K1C Build/RKQ1.201112.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045534 Mobile Safari/537.36', 83 | } 84 | } 85 | $.post(options, (err, resp, data) => { 86 | try { 87 | if (err) { 88 | console.log(`${JSON.stringify(err)}`) 89 | console.log(`${$.name} API请求失败,请检查网路重试`); 90 | } else { 91 | data = JSON.parse(data); 92 | $.checkLoginHeaders = resp.headers; 93 | // $.log(`errcode:${data['errcode']}`) 94 | } 95 | } catch (e) { 96 | $.logErr(e, resp) 97 | } finally { 98 | resolve(data); 99 | } 100 | }) 101 | }) 102 | } 103 | 104 | function getCookie() { 105 | $.timer = setInterval(async () => { 106 | const checkRes = await checkLogin(); 107 | if (checkRes['errcode'] === 0) { 108 | //扫描登录成功 109 | $.log(`扫描登录成功\n`) 110 | clearInterval($.timer); 111 | await formatCookie($.checkLoginHeaders); 112 | $.done(); 113 | } else if (checkRes['errcode'] === 21) { 114 | $.log(`二维码已失效,请重新获取二维码重新扫描\n`); 115 | clearInterval($.timer); 116 | $.done(); 117 | } else if (checkRes['errcode'] === 176) { 118 | //未扫描登录 119 | } else { 120 | $.log(`其他异常:${JSON.stringify(checkRes)}\n`); 121 | clearInterval($.timer); 122 | $.done(); 123 | } 124 | }, 1000) 125 | } 126 | 127 | function formatCookie(headers) { 128 | new Promise(resolve => { 129 | let pt_key = headers['set-cookie'][1] 130 | pt_key = pt_key.substring(pt_key.indexOf("=") + 1, pt_key.indexOf(";")) 131 | let pt_pin = headers['set-cookie'][2] 132 | pt_pin = pt_pin.substring(pt_pin.indexOf("=") + 1, pt_pin.indexOf(";")) 133 | const cookie1 = "pt_key=" + pt_key + ";pt_pin=" + pt_pin + ";"; 134 | 135 | $.UserName = decodeURIComponent(cookie1.match(/pt_pin=([^; ]+)(?=;?)/) && cookie1.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 136 | $.log(`京东用户:${$.UserName} Cookie获取成功,cookie如下:`); 137 | $.log(`\n${cookie1}\n`); 138 | resolve() 139 | }) 140 | } 141 | 142 | function formatSetCookies(headers, body) { 143 | new Promise(resolve => { 144 | s_token = body['s_token'] 145 | guid = headers['set-cookie'][0] 146 | guid = guid.substring(guid.indexOf("=") + 1, guid.indexOf(";")) 147 | lsid = headers['set-cookie'][2] 148 | lsid = lsid.substring(lsid.indexOf("=") + 1, lsid.indexOf(";")) 149 | lstoken = headers['set-cookie'][3] 150 | lstoken = lstoken.substring(lstoken.indexOf("=") + 1, lstoken.indexOf(";")) 151 | cookies = "guid=" + guid + "; lang=chs; lsid=" + lsid + "; lstoken=" + lstoken + "; " 152 | resolve() 153 | }) 154 | } 155 | 156 | function taskUrl() { 157 | return { 158 | url: `https://plogin.m.jd.com/cgi-bin/mm/new_login_entrance?lang=chs&appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport`, 159 | headers: { 160 | 'Connection': 'Keep-Alive', 161 | 'Content-Type': 'application/x-www-form-urlencoded', 162 | 'Accept': 'application/json, text/plain, */*', 163 | 'Accept-Language': 'zh-cn', 164 | 'Referer': `https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport`, 165 | 'User-Agent': 'jdapp;android;10.0.5;11;0393465333165363-5333430323261366;network/wifi;model/M2102K1C;osVer/30;appBuild/88681;partner/lc001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; M2102K1C Build/RKQ1.201112.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045534 Mobile Safari/537.36', 166 | 'Host': 'plogin.m.jd.com' 167 | } 168 | } 169 | } 170 | 171 | function taskPostUrl() { 172 | return { 173 | url: `https://plogin.m.jd.com/cgi-bin/m/tmauthreflogurl?s_token=${s_token}&v=${Date.now()}&remember=true`, 174 | body: `lang=chs&appid=300&source=wq_passport&returnurl=https://wqlogin2.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=//home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action`, 175 | headers: { 176 | 'Connection': 'Keep-Alive', 177 | 'Content-Type': 'application/x-www-form-urlencoded', 178 | 'Accept': 'application/json, text/plain, */*', 179 | 'Accept-Language': 'zh-cn', 180 | 'Referer': `https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=${Date.now()}&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport`, 181 | 'User-Agent': 'jdapp;android;10.0.5;11;0393465333165363-5333430323261366;network/wifi;model/M2102K1C;osVer/30;appBuild/88681;partner/lc001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; M2102K1C Build/RKQ1.201112.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045534 Mobile Safari/537.36', 182 | 'Host': 'plogin.m.jd.com' 183 | } 184 | } 185 | } 186 | 187 | // prettier-ignore 188 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 189 | -------------------------------------------------------------------------------- /jdCookie.js: -------------------------------------------------------------------------------- 1 | /* 2 | 此文件为Node.js专用。其他用户请忽略 3 | */ 4 | //此处填写京东账号cookie。 5 | //注:github action用户cookie填写到Settings-Secrets里面,新增JD_COOKIE,多个账号的cookie使用`&`隔开或者换行 6 | let CookieJDs = [ 7 | '',//账号一ck,例:pt_key=XXX;pt_pin=XXX; 8 | '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推 9 | ] 10 | // 判断github action里面是否有京东ck 11 | if (process.env.JD_COOKIE) { 12 | if (process.env.JD_COOKIE.indexOf('&') > -1) { 13 | console.log(`您的cookie选择的是用&隔开\n`) 14 | CookieJDs = process.env.JD_COOKIE.split('&'); 15 | } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { 16 | console.log(`您的cookie选择的是用换行隔开\n`) 17 | CookieJDs = process.env.JD_COOKIE.split('\n'); 18 | } else { 19 | CookieJDs = [process.env.JD_COOKIE]; 20 | } 21 | } 22 | CookieJDs = [...new Set(CookieJDs.filter(item => item !== "" && item !== null && item !== undefined))] 23 | console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`); 24 | console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`) 25 | for (let i = 0; i < CookieJDs.length; i++) { 26 | const index = (i + 1 === 1) ? '' : (i + 1); 27 | exports['CookieJD' + index] = CookieJDs[i].trim(); 28 | } 29 | -------------------------------------------------------------------------------- /jdDreamFactoryShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京喜工厂互助码 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。 7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 9 | let shareCodes = [ 10 | 'V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k=@Bo-jnVs_m9uBvbRzraXcSA==@-OvElMzqeyeGBWazWYjI1Q==',//账号一的好友shareCode,不同好友中间用@符号隔开 11 | '-OvElMzqeyeGBWazWYjI1Q==',//账号二的好友shareCode,不同好友中间用@符号隔开 12 | ] 13 | 14 | // 从日志获取互助码 15 | // const logShareCodes = require('./utils/jdShareCodes'); 16 | // if (logShareCodes.DREAM_FACTORY_SHARE_CODES.length > 0 && !process.env.DREAM_FACTORY_SHARE_CODES) { 17 | // process.env.DREAM_FACTORY_SHARE_CODES = logShareCodes.DREAM_FACTORY_SHARE_CODES.join('&'); 18 | // } 19 | 20 | // 判断环境变量里面是否有京喜工厂互助码 21 | if (process.env.DREAM_FACTORY_SHARE_CODES) { 22 | if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('&') > -1) { 23 | console.log(`您的互助码选择的是用&隔开\n`) 24 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('&'); 25 | } else if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('\n') > -1) { 26 | console.log(`您的互助码选择的是用换行隔开\n`) 27 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('\n'); 28 | } else { 29 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split(); 30 | } 31 | } else { 32 | console.log(`由于您环境变量(DREAM_FACTORY_SHARE_CODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 33 | } 34 | for (let i = 0; i < shareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['shareCodes' + index] = shareCodes[i]; 37 | } 38 | -------------------------------------------------------------------------------- /jdFactoryShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 东东工厂互助码 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。 7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 9 | let shareCodes = [ 10 | '',//账号一的好友shareCode,不同好友中间用@符号隔开 11 | '',//账号二的好友shareCode,不同好友中间用@符号隔开 12 | ] 13 | 14 | // 从日志获取互助码 15 | // const logShareCodes = require('./utils/jdShareCodes'); 16 | // if (logShareCodes.DDFACTORY_SHARECODES.length > 0 && !process.env.DDFACTORY_SHARECODES) { 17 | // process.env.DDFACTORY_SHARECODES = logShareCodes.DDFACTORY_SHARECODES.join('&'); 18 | // } 19 | 20 | // 判断环境变量里面是否有东东工厂互助码 21 | if (process.env.DDFACTORY_SHARECODES) { 22 | if (process.env.DDFACTORY_SHARECODES.indexOf('&') > -1) { 23 | console.log(`您的互助码选择的是用&隔开\n`) 24 | shareCodes = process.env.DDFACTORY_SHARECODES.split('&'); 25 | } else if (process.env.DDFACTORY_SHARECODES.indexOf('\n') > -1) { 26 | console.log(`您的互助码选择的是用换行隔开\n`) 27 | shareCodes = process.env.DDFACTORY_SHARECODES.split('\n'); 28 | } else { 29 | shareCodes = process.env.DDFACTORY_SHARECODES.split(); 30 | } 31 | } else { 32 | console.log(`由于您环境变量(DDFACTORY_SHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 33 | } 34 | for (let i = 0; i < shareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['shareCodes' + index] = shareCodes[i]; 37 | } -------------------------------------------------------------------------------- /jdFruitShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 东东农场互助码 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | //云服务器腾讯云函数等NOde.js用户在此处填写京东东农场的好友码。 7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 9 | let FruitShareCodes = [ 10 | '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a',//账号一的好友shareCode,不同好友中间用@符号隔开 11 | '6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3',//账号二的好友shareCode,不同好友中间用@符号隔开 12 | ] 13 | 14 | // 从日志获取互助码 15 | // const logShareCodes = require('./utils/jdShareCodes'); 16 | // if (logShareCodes.FRUITSHARECODES.length > 0 && !process.env.FRUITSHARECODES) { 17 | // process.env.FRUITSHARECODES = logShareCodes.FRUITSHARECODES.join('&'); 18 | // } 19 | 20 | // 判断github action里面是否有东东农场互助码 21 | if (process.env.FRUITSHARECODES) { 22 | if (process.env.FRUITSHARECODES.indexOf('&') > -1) { 23 | console.log(`您的东东农场互助码选择的是用&隔开\n`) 24 | FruitShareCodes = process.env.FRUITSHARECODES.split('&'); 25 | } else if (process.env.FRUITSHARECODES.indexOf('\n') > -1) { 26 | console.log(`您的东东农场互助码选择的是用换行隔开\n`) 27 | FruitShareCodes = process.env.FRUITSHARECODES.split('\n'); 28 | } else { 29 | FruitShareCodes = process.env.FRUITSHARECODES.split(); 30 | } 31 | } else { 32 | console.log(`由于您环境变量(FRUITSHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 33 | } 34 | for (let i = 0; i < FruitShareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['FruitShareCode' + index] = FruitShareCodes[i]; 37 | } 38 | -------------------------------------------------------------------------------- /jdJxncShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京喜农场助力码 3 | 此助力码要求种子 active 相同才能助力,多个账号的话可以种植同样的种子,如果种子不同的话,会自动跳过使用云端助力 4 | 此文件为Node.js专用。其他用户请忽略 5 | 支持京东N个账号 6 | */ 7 | //云服务器腾讯云函数等NOde.js用户在此处填写京京喜农场的好友码。 8 | // 同一个京东账号的好友助力码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 9 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 10 | // 注意:京喜农场 种植种子发生变化的时候,互助码也会变!! 11 | // 注意:京喜农场 种植种子发生变化的时候,互助码也会变!! 12 | // 注意:京喜农场 种植种子发生变化的时候,互助码也会变!! 13 | // 每个账号 shareCdoe 是一个 json,示例如下 14 | // {"smp":"22bdadsfaadsfadse8a","active":"jdnc_1_btorange210113_2","joinnum":"1"} 15 | let JxncShareCodes = [ 16 | '',//账号一的好友shareCode,不同好友中间用@符号隔开 17 | '',//账号二的好友shareCode,不同好友中间用@符号隔开 18 | ] 19 | // 判断github action里面是否有京喜农场助力码 20 | if (process.env.JXNC_SHARECODES) { 21 | if (process.env.JXNC_SHARECODES.indexOf('&') > -1) { 22 | console.log(`您的京喜农场助力码选择的是用&隔开\n`) 23 | JxncShareCodes = process.env.JXNC_SHARECODES.split('&'); 24 | } else if (process.env.JXNC_SHARECODES.indexOf('\n') > -1) { 25 | console.log(`您的京喜农场助力码选择的是用换行隔开\n`) 26 | JxncShareCodes = process.env.JXNC_SHARECODES.split('\n'); 27 | } else { 28 | JxncShareCodes = process.env.JXNC_SHARECODES.split(); 29 | } 30 | } else { 31 | console.log(`由于您环境变量里面(JXNC_SHARECODES)未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 32 | } 33 | JxncShareCodes = JxncShareCodes.filter(item => !!item); 34 | for (let i = 0; i < JxncShareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['JxncShareCode' + index] = JxncShareCodes[i]; 37 | } 38 | -------------------------------------------------------------------------------- /jdJxncTokens.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京喜农场 Tokens 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | // 每个账号 token 是一个 json,示例如下 7 | // {"farm_jstoken":"749a90f871adsfads8ffda7bf3b1576760","timestamp":"1610165423873","phoneid":"42c7e3dadfadsfdsaac-18f0e4f4a0cf"} 8 | let JxncTokens = [ 9 | '',//账号一的京喜农场token 10 | '',//账号二的京喜农场token 11 | ] 12 | // 判断github action里面是否有京喜农场 token 13 | if (process.env.JXNCTOKENS) { 14 | if (process.env.JXNCTOKENS.indexOf('&') > -1) { 15 | console.log(`您的京喜农场 token 选择的是用&隔开\n`) 16 | JxncTokens = process.env.JXNCTOKENS.split('&'); 17 | } else if (process.env.JXNCTOKENS.indexOf('\n') > -1) { 18 | console.log(`您的京喜农场 token 选择的是用换行隔开\n`) 19 | JxncTokens = process.env.JXNCTOKENS.split('\n'); 20 | } else { 21 | JxncTokens = process.env.JXNCTOKENS.split(); 22 | } 23 | } else if (process.env.JD_COOKIE) { 24 | console.log(`由于您secret里面未提供 tokens,当种植 APP 种子时,将不能正常进行任务,请提供 token 或 种植非 APP 种子!`) 25 | } 26 | JxncTokens = [...new Set(JxncTokens.filter(item => !!item))] 27 | for (let i = 0; i < JxncTokens.length; i++) { 28 | const index = (i + 1 === 1) ? '' : (i + 1); 29 | exports['JXNCTOKEN' + index] = JxncTokens[i]; 30 | } 31 | -------------------------------------------------------------------------------- /jdPetShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 东东萌宠互助码 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。 7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 9 | let PetShareCodes = [ 10 | 'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==',//账号一的好友shareCode,不同好友中间用@符号隔开 11 | 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==',//账号二的好友shareCode,不同好友中间用@符号隔开 12 | ] 13 | 14 | // 从日志获取互助码 15 | // const logShareCodes = require('./utils/jdShareCodes'); 16 | // if (logShareCodes.PETSHARECODES.length > 0 && !process.env.PETSHARECODES) { 17 | // process.env.PETSHARECODES = logShareCodes.PETSHARECODES.join('&'); 18 | // } 19 | 20 | // 判断github action里面是否有东东萌宠互助码 21 | if (process.env.PETSHARECODES) { 22 | if (process.env.PETSHARECODES.indexOf('&') > -1) { 23 | console.log(`您的东东萌宠互助码选择的是用&隔开\n`) 24 | PetShareCodes = process.env.PETSHARECODES.split('&'); 25 | } else if (process.env.PETSHARECODES.indexOf('\n') > -1) { 26 | console.log(`您的东东萌宠互助码选择的是用换行隔开\n`) 27 | PetShareCodes = process.env.PETSHARECODES.split('\n'); 28 | } else { 29 | PetShareCodes = process.env.PETSHARECODES.split(); 30 | } 31 | } else { 32 | console.log(`由于您环境变量(PETSHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 33 | } 34 | for (let i = 0; i < PetShareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['PetShareCode' + index] = PetShareCodes[i]; 37 | } -------------------------------------------------------------------------------- /jdPlantBeanShareCodes.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京东种豆得豆互助码 3 | 此文件为Node.js专用。其他用户请忽略 4 | 支持京东N个账号 5 | */ 6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。 7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例 8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2 9 | let PlantBeanShareCodes = [ 10 | '66j4yt3ebl5ierjljoszp7e4izzbzaqhi5k2unz2afwlyqsgnasq@olmijoxgmjutyrsovl2xalt2tbtfmg6sqldcb3q@e7lhibzb3zek27amgsvywffxx7hxgtzstrk2lba@olmijoxgmjutyx55upqaqxrblt7f3h26dgj2riy',//账号一的好友shareCode,不同好友中间用@符号隔开 11 | 'mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziy@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziy',//账号二的好友shareCode,不同好友中间用@符号隔开 12 | ] 13 | 14 | // 从日志获取互助码 15 | // const logShareCodes = require('./utils/jdShareCodes'); 16 | // if (logShareCodes.PLANT_BEAN_SHARECODES.length > 0 && !process.env.PLANT_BEAN_SHARECODES) { 17 | // process.env.PLANT_BEAN_SHARECODES = logShareCodes.PLANT_BEAN_SHARECODES.join('&'); 18 | // } 19 | 20 | // 判断github action里面是否有种豆得豆互助码 21 | if (process.env.PLANT_BEAN_SHARECODES) { 22 | if (process.env.PLANT_BEAN_SHARECODES.indexOf('&') > -1) { 23 | console.log(`您的种豆互助码选择的是用&隔开\n`) 24 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('&'); 25 | } else if (process.env.PLANT_BEAN_SHARECODES.indexOf('\n') > -1) { 26 | console.log(`您的种豆互助码选择的是用换行隔开\n`) 27 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('\n'); 28 | } else { 29 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split(); 30 | } 31 | } else { 32 | console.log(`由于您环境变量(PLANT_BEAN_SHARECODES)里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`) 33 | } 34 | for (let i = 0; i < PlantBeanShareCodes.length; i++) { 35 | const index = (i + 1 === 1) ? '' : (i + 1); 36 | exports['PlantBeanShareCodes' + index] = PlantBeanShareCodes[i]; 37 | } 38 | -------------------------------------------------------------------------------- /jd_cfdtx.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | Name:财富岛提现 4 | Address: 京喜App ====>>>> 全民赚大钱 5 | Author:MoPoQAQ ====>>>> 由zero205(zero205)进行二次修改,兼容elecV2P运行 6 | Update: 2021/2/2 13:00 7 | Thanks: 8 | 💢疯疯💢 9 | 银河大佬:https://github.com/zbt494 10 | * 获取京喜tokens方式 11 | * 打开京喜农场,手动完成任意任务,必须完成任务领到水滴,提示获取cookie成功 12 | * 打开京喜工厂,收取电力,提示获取cookie成功 13 | * 打开京喜财富岛,手动成功提现一次,提示获取cookie成功 14 | * 手动任意完成,提示获取cookie成功即可,然后退出跑任务脚本 15 | 16 | hostname = wq.jd.com, m.jingxi.com 17 | 18 | # quanx 19 | [rewrite_local] 20 | ^https\:\/\/wq\.jd\.com\/cubeactive\/farm\/dotask url script-request-header https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 21 | ^https\:\/\/m\.jingxi\.com\/dreamfactory\/generator\/CollectCurrentElectricity url script-request-header https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 22 | ^https\:\/\/m\.jingxi\.com\/jxcfd\/consume\/CashOut url script-request-header https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 23 | 24 | # loon 25 | [Script] 26 | http-request ^https\:\/\/wq\.jd\.com\/cubeactive\/farm\/dotask script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js, requires-body=false, timeout=10, tag=京喜token 27 | http-request ^https\:\/\/m\.jingxi\.com\/dreamfactory\/generator\/CollectCurrentElectricity script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js, requires-body=false, timeout=10, tag=京喜token 28 | http-request ^^https\:\/\/m\.jingxi\.com\/jxcfd\/consume\/CashOut script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js, requires-body=false, timeout=10, tag=京喜token 29 | 30 | # surge 31 | [Script] 32 | 京喜token = type=http-request,pattern=^https\:\/\/wq\.jd\.com\/cubeactive\/farm\/dotask,requires-body=0,max-size=0,script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 33 | 京喜token = type=http-request,pattern=^https\:\/\/m\.jingxi\.com\/dreamfactory\/generator\/CollectCurrentElectricity,requires-body=0,max-size=0,script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 34 | 京喜token = type=http-request,pattern=^https\:\/\/m\.jingxi\.com\/jxcfd\/consume\/CashOut,requires-body=0,max-size=0,script-path=https://raw.githubusercontent.com/whyour/hundun/master/quanx/jx_tokens.js 35 | 36 | * 37 | **/ 38 | 39 | const $ = new Env("京喜财富岛提现"); 40 | const JD_API_HOST = "https://m.jingxi.com/"; 41 | const jdCookieNode = $.isNode() ? require("./jdCookie.js") : ""; 42 | const jdTokenNode = $.isNode() ? require('./jdJxncTokens.js') : ''; 43 | $.result = []; 44 | $.cookieArr = []; 45 | $.currentCookie = ''; 46 | $.tokenArr = []; 47 | $.currentToken = {'farm_jstoken': '', 'phoneid': '', 'timestamp': ''}; 48 | $.strPhoneID = ''; 49 | $.strPgUUNum = ''; 50 | $.userName = ''; 51 | 52 | !(async () => { 53 | if (!getCookies()) return; 54 | if (!getTokens()) return; 55 | for (let i = 0; i < $.cookieArr.length; i++) { 56 | $.currentCookie = $.cookieArr[i]; 57 | $.currentToken = $.tokenArr[i]; 58 | if ($.currentCookie) { 59 | $.userName = decodeURIComponent($.currentCookie.match(/pt_pin=(.+?);/) && $.currentCookie.match(/pt_pin=(.+?);/)[1]); 60 | $.log(`\n开始【京东账号${i + 1}】${$.userName}`); 61 | 62 | await cashOut(); 63 | } 64 | } 65 | await showMsg(); 66 | })() 67 | .catch((e) => $.logErr(e)) 68 | .finally(() => $.done()); 69 | 70 | function cashOut() { 71 | return new Promise(async (resolve) => { 72 | $.get( 73 | taskUrl( 74 | `consume/CashOut`, 75 | `ddwMoney=100&dwIsCreateToken=0&ddwMinPaperMoney=150000&strPgtimestamp=${$.currentToken['timestamp']}&strPhoneID=${$.currentToken['phoneid']}&strPgUUNum=${$.currentToken['farm_jstoken']}` 76 | ), 77 | async (err, resp, data) => { 78 | try { 79 | $.log(data); 80 | const { iRet, sErrMsg } = JSON.parse(data); 81 | $.log(sErrMsg); 82 | $.result.push(`【${$.userName}】\n ${sErrMsg == "" ? sErrMsg="今天手气太棒了" : sErrMsg}`); 83 | resolve(sErrMsg); 84 | } catch (e) { 85 | $.logErr(e, resp); 86 | } finally { 87 | resolve(); 88 | } 89 | } 90 | ); 91 | }); 92 | } 93 | 94 | function taskUrl(function_path, body) { 95 | return { 96 | url: `${JD_API_HOST}jxcfd/${function_path}?strZone=jxcfd&bizCode=jxcfd&source=jxcfd&dwEnv=7&_cfd_t=${Date.now()}&ptag=&${body}&_stk=_cfd_t%2CbizCode%2CddwMinPaperMoney%2CddwMoney%2CdwEnv%2CdwIsCreateToken%2Cptag%2Csource%2CstrPgUUNum%2CstrPgtimestamp%2CstrPhoneID%2CstrZone&_ste=1&_=${Date.now()}&sceneval=2&g_login_type=1&g_ty=ls`, 97 | headers: { 98 | Cookie: $.currentCookie, 99 | Accept: "*/*", 100 | Connection: "keep-alive", 101 | Referer:"https://st.jingxi.com/fortune_island/cash.html?jxsid=16115391812299482601&_f_i_jxapp=1", 102 | "Accept-Encoding": "gzip, deflate, br", 103 | Host: "m.jingxi.com", 104 | "User-Agent":"jdpingou;iPhone;4.1.4;14.3;9f08e3faf2c0b4e72900552400dfad2e7b2273ba;network/wifi;model/iPhone11,6;appBuild/100415;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/428;pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 105 | "Accept-Language": "zh-cn", 106 | }, 107 | }; 108 | } 109 | 110 | function getCookies() { 111 | if ($.isNode()) { 112 | $.cookieArr = Object.values(jdCookieNode); 113 | } else { 114 | $.cookieArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); 115 | } 116 | if (!$.cookieArr[0]) { 117 | $.msg( 118 | $.name, 119 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", 120 | "https://bean.m.jd.com/", 121 | { 122 | "open-url": "https://bean.m.jd.com/", 123 | } 124 | ); 125 | return false; 126 | } 127 | return true; 128 | } 129 | 130 | function getTokens() { 131 | if ($.isNode()) { 132 | Object.keys(jdTokenNode).forEach((item) => { 133 | $.tokenArr.push(jdTokenNode[item] ? JSON.parse(jdTokenNode[item]) : '{}'); 134 | }) 135 | } else { 136 | $.tokenArr = JSON.parse($.getdata('jx_tokens') || '[]'); 137 | } 138 | if (!$.tokenArr[0]) { 139 | $.msg( 140 | $.name, 141 | "【⏰提示】请先获取京喜Token\n获取方式见脚本说明" 142 | ); 143 | return false; 144 | } 145 | return true; 146 | } 147 | 148 | function showMsg() { 149 | return new Promise((resolve) => { 150 | if ($.notifyTime) { 151 | const notifyTimes = $.notifyTime.split(",").map((x) => x.split(":")); 152 | const now = $.time("HH:mm").split(":"); 153 | $.log(`\n${JSON.stringify(notifyTimes)}`); 154 | $.log(`\n${JSON.stringify(now)}`); 155 | if ( 156 | notifyTimes.some((x) => x[0] === now[0] && (!x[1] || x[1] === now[1])) 157 | ) { 158 | $.msg($.name, "", `\n${$.result.join("\n")}`); 159 | } 160 | } else { 161 | $.msg($.name, "", `\n${$.result.join("\n")}`); 162 | } 163 | resolve(); 164 | }); 165 | } 166 | 167 | function jsonParse(str) { 168 | if (typeof str == "string") { 169 | try { 170 | return JSON.parse(str); 171 | } catch (e) { 172 | console.log(e); 173 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 174 | return []; 175 | } 176 | } 177 | } 178 | 179 | // prettier-ignore 180 | 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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),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){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} -------------------------------------------------------------------------------- /jd_ckcheck.js: -------------------------------------------------------------------------------- 1 | /* 2 | export tswb="" ##自定义变量 自定义发送的文本内容 如 老弟 你的CK实效了 打开*******5701 扫码更新 3 | */ 4 | // [task_local] 5 | // */60 * * * * 6 | // 自己复制定时 7 | 8 | const $ = new Env('柠檬CK检测'); 9 | const notify = $.isNode() ? require('./sendNotify') : ''; 10 | //Node.js用户请在jdCookie.js处填写京东ck; 11 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 12 | 13 | //IOS等用户直接用NobyDa的jd cookie 14 | let cookiesArr = [], cookie = '', message; 15 | let allMessage = ''; 16 | let tswb = '';//变量 你想要自定义发送的文本内容 如 老弟 你的CK实效了 打开*******5701 扫码更新 17 | 18 | if (process.env.tswb) { 19 | tswb = process.env.tswb; 20 | } 21 | 22 | if ($.isNode()) { 23 | Object.keys(jdCookieNode).forEach((item) => { 24 | cookiesArr.push(jdCookieNode[item]) 25 | }) 26 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 27 | } else { 28 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); 29 | } 30 | const JD_API_HOST = 'https://api.m.jd.com/client.action'; 31 | 32 | !(async () => { 33 | if (!cookiesArr[0]) { 34 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 35 | return; 36 | } 37 | 38 | for (let i = 0; i < cookiesArr.length; i++) { 39 | if (cookiesArr[i]) { 40 | cookie = cookiesArr[i]; 41 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 42 | $.index = i + 1; 43 | $.isLogin = true; 44 | $.nickName = ''; 45 | message = ''; 46 | await TotalBean(); 47 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); 48 | if (!$.isLogin) { 49 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 50 | 51 | if ($.isNode()) { 52 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n${tswb}`); 53 | } 54 | continue 55 | } 56 | 57 | 58 | 59 | 60 | 61 | 62 | } 63 | } 64 | if ($.isNode() && allMessage) { 65 | await notify.sendNotify(`${$.name}`, `${allMessage}` ) 66 | } 67 | })() 68 | .catch((e) => { 69 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') 70 | }) 71 | .finally(() => { 72 | $.done(); 73 | }) 74 | 75 | async function TotalBean() { 76 | return new Promise(async resolve => { 77 | const options = { 78 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, 79 | "headers": { 80 | "Accept": "application/json,text/plain, */*", 81 | "Content-Type": "application/x-www-form-urlencoded", 82 | "Accept-Encoding": "gzip, deflate, br", 83 | "Accept-Language": "zh-cn", 84 | "Connection": "keep-alive", 85 | "Cookie": cookie, 86 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", 87 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 88 | } 89 | } 90 | $.post(options, (err, resp, data) => { 91 | try { 92 | if (err) { 93 | console.log(`${JSON.stringify(err)}`) 94 | console.log(`${$.name} API请求失败,请检查网路重试`) 95 | } else { 96 | if (data) { 97 | data = JSON.parse(data); 98 | if (data["retcode"] === 13) { 99 | $.isLogin = false; //cookie过期 100 | $.log("cookie失效") 101 | return; 102 | } 103 | if (data["retcode"] === 0) { 104 | $.nickName = (data["base"] && data["base"].nickname) || $.UserName; 105 | $.log("cookie正常") 106 | } else { 107 | $.nickName = $.UserName; 108 | $.log("cookie正常") 109 | } 110 | } else { 111 | console.log(`京东服务器返回空数据`) 112 | } 113 | } 114 | } catch (e) { 115 | $.logErr(e, resp) 116 | } finally { 117 | resolve(); 118 | } 119 | }) 120 | }) 121 | } 122 | async function safeGet(data) { 123 | try { 124 | if (typeof JSON.parse(data) == "object") { 125 | return true; 126 | } 127 | } catch (e) { 128 | console.log(e); 129 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 130 | return false; 131 | } 132 | } 133 | function jsonParse(str) { 134 | if (typeof str == "string") { 135 | try { 136 | return JSON.parse(str); 137 | } catch (e) { 138 | console.log(e); 139 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 140 | return []; 141 | } 142 | } 143 | } 144 | // prettier-ignore 145 | 146 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 147 | -------------------------------------------------------------------------------- /jd_deleteCoupon.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京东删除优惠券 3 | 更新时间:2021-02-24 14:35 4 | 脚本说明:误删除的去电脑端恢复 5 | 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 6 | // quantumultx 7 | [task_local] 8 | #京东删除优惠券 9 | 11 0 * * 1 https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_deleteCoupon.js, tag=京东删除优惠券, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true 10 | // Loon 11 | [Script] 12 | cron "11 0 * * 1" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_deleteCoupon.js,tag=京东删除优惠券 13 | // Surge 14 | 京东删除优惠券 = type=cron,cronexp=11 0 * * 1,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_deleteCoupon.js 15 | */ 16 | const $ = new Env('京东删除优惠券'); 17 | //Node.js用户请在jdCookie.js处填写京东ck; 18 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 19 | const printDetail = false //是否显示出参详情 20 | let leaveList = $.getdata("CFG_DELCOUPON_LEAVE")||'' 21 | //IOS等用户直接用NobyDa的jd cookie 22 | let cookiesArr = [], cookie = ''; 23 | if ($.isNode()) { 24 | Object.keys(jdCookieNode).forEach((item) => { 25 | cookiesArr.push(jdCookieNode[item]) 26 | }) 27 | } else { 28 | cookiesArr.push($.getdata('CookieJD')); 29 | cookiesArr.push($.getdata('CookieJD2')); 30 | } 31 | 32 | const JD_API_HOST = `https://wq.jd.com/activeapi/`; 33 | !(async () => { 34 | if (!cookiesArr[0]) { 35 | $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); 36 | return; 37 | } 38 | leaveList = leaveList ? leaveList.split(',') : [] ; 39 | console.log('设置的保留关键字:' + leaveList.toString()) 40 | for (let i = 0; i < cookiesArr.length; i++) { 41 | cookie = cookiesArr[i]; 42 | if (cookie) { 43 | if (i) console.log(`\n***************开始京东账号${i + 1}***************`) 44 | await initial() 45 | await queryJdUserInfo(); 46 | if (!merge.enabled) { //cookie不可用 47 | $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 48 | $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); 49 | continue; 50 | } 51 | await queryJdCouponListWithFinance() 52 | //break 53 | } 54 | } 55 | })() 56 | .catch((e) => $.logErr(e)) 57 | .finally(() => $.done()) 58 | 59 | 60 | //获取昵称(直接用,勿删) 61 | function queryJdUserInfo(timeout = 0) { 62 | return new Promise((resolve) => { 63 | setTimeout( ()=>{ 64 | let url = { 65 | url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, 66 | headers : { 67 | 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, 68 | 'Cookie' : cookie 69 | } 70 | } 71 | $.get(url, (err, resp, data) => { 72 | try { 73 | if (printDetail) console.log(data) 74 | data = JSON.parse(data); 75 | if (data.retcode === 13) { 76 | merge.enabled = false 77 | return 78 | } 79 | merge.nickname = data.base.nickname; 80 | } catch (e) { 81 | $.logErr(e, resp); 82 | } finally { 83 | resolve() 84 | } 85 | }) 86 | },timeout) 87 | }) 88 | } 89 | 90 | //查询优惠券 91 | function queryJdCouponListWithFinance(timeout = 0){ 92 | return new Promise((resolve) => { 93 | setTimeout( ()=>{ 94 | let url = { 95 | url : `${JD_API_HOST}queryjdcouponlistwithfinance?state=1&wxadd=1&filterswitch=1&_=${Date.now()}&sceneval=2&g_login_type=1&callback=dealCouponList`, 96 | headers : { 97 | 'Cookie' : cookie, 98 | 'Connection' : `keep-alive`, 99 | 'Accept' : `*/*`, 100 | 'Referer' : `https://wqs.jd.com/my/coupon/index.shtml`, 101 | 'Host' : `wq.jd.com`, 102 | 'Accept-Encoding' : `gzip, deflate, br`, 103 | 'Accept-Language' : `zh-cn` 104 | } 105 | } 106 | $.get(url, async (err, resp, data) => { 107 | try { 108 | await eval(data) 109 | } catch (e) { 110 | $.logErr(e, resp); 111 | } finally { 112 | resolve() 113 | } 114 | }) 115 | },timeout) 116 | }) 117 | } 118 | 119 | function dealCouponList(data,timeout = 0){ 120 | return new Promise((resolve) => { 121 | setTimeout(async () => { 122 | try { 123 | if (printDetail) console.log(JSON.stringify(data)) 124 | for (let i in data.coupon.useable) { 125 | if (data.coupon.useable[i].couponStyle === 2) continue //运费券 126 | if (data.coupon.useable[i].couponStyle === 8) continue //支付券 127 | if (data.coupon.useable[i].limitStr.match(/京贴|全品类/)) continue //京贴、全品类 暂不处理 128 | if (data.coupon.useable[i].discountInfo.info.length) { 129 | console.log(data.coupon.useable[i].limitStr + " 满" + parseFloat(data.coupon.useable[i].discountInfo.info[0].quota).toFixed(0) + "打" + parseFloat(data.coupon.useable[i].discountInfo.info[0].discountRate) * 10 + "折") 130 | } else { 131 | console.log(data.coupon.useable[i].limitStr + " " + parseFloat(data.coupon.useable[i].quota).toFixed(0) + '-' + parseFloat(data.coupon.useable[i].discount).toFixed(0)) 132 | } 133 | let couponInfoList = encodeURIComponent(data.coupon.useable[i].couponid + ',' +data.coupon.useable[i].coupontype + ',' + data.coupon.useable[i].couponStyle) 134 | let doNext = false 135 | if (!leaveList.length) { 136 | await deleteCouponListWithFinance(couponInfoList) 137 | } else { 138 | for (let j in leaveList) { 139 | if (data.coupon.useable[i].limitStr.match(new RegExp(leaveList[j]))) { 140 | doNext = true 141 | break 142 | } 143 | } 144 | if (doNext) { 145 | continue 146 | } else { 147 | await deleteCouponListWithFinance(couponInfoList) 148 | } 149 | } 150 | } 151 | } catch (e) { 152 | $.logErr(e); 153 | } finally { 154 | resolve() 155 | } 156 | }, timeout) 157 | }) 158 | } 159 | 160 | //删除优惠券 161 | function deleteCouponListWithFinance(couponInfoList,timeout = 0){ 162 | return new Promise((resolve) => { 163 | setTimeout( ()=>{ 164 | let url = { 165 | url : `${JD_API_HOST}deletecouponlistwithfinance?couponinfolist=${couponInfoList}&_=${Date.now()}&sceneval=2&g_login_type=1&callback=jsonpCBKE&g_ty=ls`, 166 | headers : { 167 | 'Cookie' : cookie, 168 | 'Connection' : `keep-alive`, 169 | 'Accept' : `*/*`, 170 | 'Referer' : `https://wqs.jd.com/my/coupon/index.shtml`, 171 | 'Host' : `wq.jd.com`, 172 | 'Accept-Encoding' : `gzip, deflate, br`, 173 | 'Accept-Language' : `zh-cn` 174 | } 175 | } 176 | $.get(url, async (err, resp, data) => { 177 | try { 178 | data = data.match(/(jsonpCBKE\()(.+)/)[2] 179 | if (printDetail) console.log(data) 180 | data = JSON.parse(data) 181 | if (data.retcode) { 182 | console.log('删除失败:' + data.retmsg) 183 | } else { 184 | console.log('删除成功') 185 | } 186 | } catch (e) { 187 | $.logErr(e, resp); 188 | } finally { 189 | resolve() 190 | } 191 | }) 192 | },timeout) 193 | }) 194 | } 195 | 196 | 197 | //初始化 198 | function initial() { 199 | merge = { 200 | nickname: "", 201 | enabled: true 202 | } 203 | } 204 | 205 | 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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,g=-8){ let f=new Date().getTimezoneOffset();let d=new Date().getTime()+ f * 60 * 1000 - (g * 60 * 60 * 1000); let n = new Date(d);let e={"M+":n.getMonth()+1,"d+":n.getDate(),"H+":n.getHours(),"m+":n.getMinutes(),"s+":n.getSeconds(),"q+":Math.floor((n.getMonth()+3)/3),S:n.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(n.getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 206 | -------------------------------------------------------------------------------- /jd_djfruit.js: -------------------------------------------------------------------------------- 1 | /* 2 | *v5.4 3 | *京东到家果园任务脚本,支持qx,loon,shadowrocket,surge,nodejs 4 | *兼容京东jdCookie.js 5 | *手机设备在boxjs里填写cookie 6 | [task_local] 7 | 10 0,3,8,11,17 * * * https://raw.githubusercontent.com/colakele/js/main/jd_djfruit.js 8 | [Script] 9 | cron "10 0,3,8,11,17 * * *" script-path=https://raw.githubusercontent.com/passerby-b/JDDJ/main/jddj_fruit.js,tag=京东到家果园任务 10 | */ 11 | 12 | let isNotify = true;//是否通知,仅限nodejs 13 | let ckPath = './jdCookie.js';//ck路径,环境变量:JDDJ_CKPATH 14 | 15 | const $ = new API("jddj_fruit"); 16 | try { 17 | //https://cdn.jsdelivr.net/gh/passerby-b/JDDJ@main/jddj_fruit_code.js 18 | $.http.get({ url: 'https://ghproxy.com/https://raw.githubusercontent.com/colakele/jd/main/jddjfruitcode.js' }).then(response => { 19 | if (!!response.body) eval(response.body); 20 | }); 21 | } catch (error) { 22 | console.log(error); 23 | $.done(); 24 | } 25 | 26 | /*********************************** API *************************************/ 27 | function ENV() { const e = "undefined" != typeof $task, t = "undefined" != typeof $loon, s = "undefined" != typeof $httpClient && !t, i = "function" == typeof require && "undefined" != typeof $jsbox; return { isQX: e, isLoon: t, isSurge: s, isNode: "function" == typeof require && !i, isJSBox: i, isRequest: "undefined" != typeof $request, isScriptable: "undefined" != typeof importModule } } function HTTP(e = { baseURL: "" }) { const { isQX: t, isLoon: s, isSurge: i, isScriptable: n, isNode: o } = ENV(), r = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)/; const u = {}; return ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"].forEach(l => u[l.toLowerCase()] = (u => (function (u, l) { l = "string" == typeof l ? { url: l } : l; const h = e.baseURL; h && !r.test(l.url || "") && (l.url = h ? h + l.url : l.url); const a = (l = { ...e, ...l }).timeout, c = { onRequest: () => { }, onResponse: e => e, onTimeout: () => { }, ...l.events }; let f, d; if (c.onRequest(u, l), t) f = $task.fetch({ method: u, ...l }); else if (s || i || o) f = new Promise((e, t) => { (o ? require("request") : $httpClient)[u.toLowerCase()](l, (s, i, n) => { s ? t(s) : e({ statusCode: i.status || i.statusCode, headers: i.headers, body: n }) }) }); else if (n) { const e = new Request(l.url); e.method = u, e.headers = l.headers, e.body = l.body, f = new Promise((t, s) => { e.loadString().then(s => { t({ statusCode: e.response.statusCode, headers: e.response.headers, body: s }) }).catch(e => s(e)) }) } const p = a ? new Promise((e, t) => { d = setTimeout(() => (c.onTimeout(), t(`${u} URL: ${l.url} exceeds the timeout ${a} ms`)), a) }) : null; return (p ? Promise.race([p, f]).then(e => (clearTimeout(d), e)) : f).then(e => c.onResponse(e)) })(l, u))), u } function API(e = "untitled", t = !1) { const { isQX: s, isLoon: i, isSurge: n, isNode: o, isJSBox: r, isScriptable: u } = ENV(); return new class { constructor(e, t) { this.name = e, this.debug = t, this.http = HTTP(), this.env = ENV(), this.node = (() => { if (o) { return { fs: require("fs") } } return null })(), this.initCache(); Promise.prototype.delay = function (e) { return this.then(function (t) { return ((e, t) => new Promise(function (s) { setTimeout(s.bind(null, t), e) }))(e, t) }) } } initCache() { if (s && (this.cache = JSON.parse($prefs.valueForKey(this.name) || "{}")), (i || n) && (this.cache = JSON.parse($persistentStore.read(this.name) || "{}")), o) { let e = "root.json"; this.node.fs.existsSync(e) || this.node.fs.writeFileSync(e, JSON.stringify({}), { flag: "wx" }, e => console.log(e)), this.root = {}, e = `${this.name}.json`, this.node.fs.existsSync(e) ? this.cache = JSON.parse(this.node.fs.readFileSync(`${this.name}.json`)) : (this.node.fs.writeFileSync(e, JSON.stringify({}), { flag: "wx" }, e => console.log(e)), this.cache = {}) } } persistCache() { const e = JSON.stringify(this.cache, null, 2); s && $prefs.setValueForKey(e, this.name), (i || n) && $persistentStore.write(e, this.name), o && (this.node.fs.writeFileSync(`${this.name}.json`, e, { flag: "w" }, e => console.log(e)), this.node.fs.writeFileSync("root.json", JSON.stringify(this.root, null, 2), { flag: "w" }, e => console.log(e))) } write(e, t) { if (this.log(`SET ${t}`), -1 !== t.indexOf("#")) { if (t = t.substr(1), n || i) return $persistentStore.write(e, t); if (s) return $prefs.setValueForKey(e, t); o && (this.root[t] = e) } else this.cache[t] = e; this.persistCache() } read(e) { return this.log(`READ ${e}`), -1 === e.indexOf("#") ? this.cache[e] : (e = e.substr(1), n || i ? $persistentStore.read(e) : s ? $prefs.valueForKey(e) : o ? this.root[e] : void 0) } delete(e) { if (this.log(`DELETE ${e}`), -1 !== e.indexOf("#")) { if (e = e.substr(1), n || i) return $persistentStore.write(null, e); if (s) return $prefs.removeValueForKey(e); o && delete this.root[e] } else delete this.cache[e]; this.persistCache() } notify(e, t = "", l = "", h = {}) { const a = h["open-url"], c = h["media-url"]; if (s && $notify(e, t, l, h), n && $notification.post(e, t, l + `${c ? "\n多媒体:" + c : ""}`, { url: a }), i) { let s = {}; a && (s.openUrl = a), c && (s.mediaUrl = c), "{}" === JSON.stringify(s) ? $notification.post(e, t, l) : $notification.post(e, t, l, s) } if (o || u) { const s = l + (a ? `\n点击跳转: ${a}` : "") + (c ? `\n多媒体: ${c}` : ""); if (r) { require("push").schedule({ title: e, body: (t ? t + "\n" : "") + s }) } else console.log(`${e}\n${t}\n${s}\n\n`) } } log(e) { this.debug && console.log(`[${this.name}] LOG: ${this.stringify(e)}`) } info(e) { console.log(`[${this.name}] INFO: ${this.stringify(e)}`) } error(e) { console.log(`[${this.name}] ERROR: ${this.stringify(e)}`) } wait(e) { return new Promise(t => setTimeout(t, e)) } done(e = {}) { console.log('done!'); s || i || n ? $done(e) : o && !r && "undefined" != typeof $context && ($context.headers = e.headers, $context.statusCode = e.statusCode, $context.body = e.body) } stringify(e) { if ("string" == typeof e || e instanceof String) return e; try { return JSON.stringify(e, null, 2) } catch (e) { return "[object Object]" } } }(e, t) } 28 | /*****************************************************************************/ 29 | -------------------------------------------------------------------------------- /jd_health_collect.js: -------------------------------------------------------------------------------- 1 | // author: 疯疯 2 | /* 3 | 东东健康社区收集能量收集能量(不做任务,任务脚本请使用jd_health.js) 4 | 更新时间:2021-4-23 5 | 活动入口:京东APP首页搜索 "玩一玩"即可 6 | 7 | 已支持IOS多京东账号,Node.js支持N个京东账号 8 | 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 9 | ===================quantumultx================ 10 | [task_local] 11 | #东东健康社区收集能量 12 | 5-45/20 * * * * jd_health_collect.js, tag=东东健康社区收集能量, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true 13 | 14 | =====================Loon================ 15 | [Script] 16 | cron "5-45/20 * * * *" script-path=jd_health_collect.js, tag=东东健康社区收集能量 17 | 18 | ====================Surge================ 19 | 东东健康社区收集能量 = type=cron,cronexp="5-45/20 * * * *",wake-system=1,timeout=3600,script-path=jd_health_collect.js 20 | 21 | ============小火箭========= 22 | 东东健康社区收集能量 = type=cron,script-path=jd_health_collect.js, cronexpr="5-45/20 * * * *", timeout=3600, enable=true 23 | */ 24 | const $ = new Env("东东健康社区收集能量收集"); 25 | const jdCookieNode = $.isNode() ? require("./jdCookie.js") : ""; 26 | let cookiesArr = [], 27 | cookie = "", 28 | message; 29 | 30 | if ($.isNode()) { 31 | Object.keys(jdCookieNode).forEach((item) => { 32 | cookiesArr.push(jdCookieNode[item]); 33 | }); 34 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {}; 35 | } else { 36 | cookiesArr = [ 37 | $.getdata("CookieJD"), 38 | $.getdata("CookieJD2"), 39 | ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie), 40 | ].filter((item) => !!item); 41 | } 42 | const JD_API_HOST = "https://api.m.jd.com/client.action"; 43 | !(async () => { 44 | if (!cookiesArr[0]) { 45 | $.msg( 46 | $.name, 47 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", 48 | "https://bean.m.jd.com/", 49 | { "open-url": "https://bean.m.jd.com/" } 50 | ); 51 | return; 52 | } 53 | for (let i = 0; i < cookiesArr.length; i++) { 54 | if (cookiesArr[i]) { 55 | cookie = cookiesArr[i]; 56 | $.UserName = decodeURIComponent( 57 | cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1] 58 | ); 59 | $.index = i + 1; 60 | message = ""; 61 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`); 62 | await collectScore(); 63 | } 64 | } 65 | })() 66 | .catch((e) => { 67 | $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, ""); 68 | }) 69 | .finally(() => { 70 | $.done(); 71 | }); 72 | 73 | function collectScore() { 74 | return new Promise((resolve) => { 75 | $.get(taskUrl("jdhealth_collectProduceScore", {}), (err, resp, data) => { 76 | try { 77 | if (safeGet(data)) { 78 | data = $.toObj(data); 79 | if (data?.data?.bizCode === 0) { 80 | if (data?.data?.result?.produceScore) 81 | console.log( 82 | `任务完成成功,获得:${ 83 | data?.data?.result?.produceScore ?? "未知" 84 | }能量` 85 | ); 86 | else 87 | console.log( 88 | `任务领取结果:${data?.data?.bizMsg ?? JSON.stringify(data)}` 89 | ); 90 | } else { 91 | console.log(`任务完成失败:${data?.data?.bizMsg ?? JSON.stringify(data)}`); 92 | } 93 | } 94 | } catch (e) { 95 | console.log(e); 96 | } finally { 97 | resolve(); 98 | } 99 | }); 100 | }); 101 | } 102 | 103 | function taskUrl(function_id, body = {}) { 104 | return { 105 | url: `${JD_API_HOST}/client.action?functionId=${function_id}&body=${escape( 106 | JSON.stringify(body) 107 | )}&client=wh5&clientVersion=1.0.0`, 108 | headers: { 109 | Cookie: cookie, 110 | origin: "https://h5.m.jd.com", 111 | referer: "https://h5.m.jd.com/", 112 | "Content-Type": "application/x-www-form-urlencoded", 113 | "User-Agent": $.isNode() 114 | ? process.env.JD_USER_AGENT 115 | ? process.env.JD_USER_AGENT 116 | : require("./USER_AGENTS").USER_AGENT 117 | : $.getdata("JDUA") 118 | ? $.getdata("JDUA") 119 | : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 120 | }, 121 | }; 122 | } 123 | 124 | function safeGet(data) { 125 | try { 126 | if (typeof JSON.parse(data) == "object") { 127 | return true; 128 | } 129 | } catch (e) { 130 | console.log(e); 131 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 132 | return false; 133 | } 134 | } 135 | 136 | // prettier-ignore 137 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 138 | -------------------------------------------------------------------------------- /jd_joy_help.js: -------------------------------------------------------------------------------- 1 | /* 2 | 宠汪汪强制为别人助力(助力一个好友你自己可以获得30积分,一天上限是帮助3个好友,自己获得90积分,不管助力是否成功,对方都会成为你的好友) 3 | 更新地址:jd_joy_help.js 4 | 更新时间:2021-1-21 5 | 活动入口:京东APP我的-更多工具-宠汪汪 6 | 目前提供了30309位好友的friendPin供使用。脚本随机从里面获取一个,助力成功后,退出小程序重新点击进去开始助力新的好友 7 | 欢迎大家使用 https://jdjoy.jd.com/pet/getFriends?itemsPerPage=20¤tPage=1 (currentPage=1表示第一页好友,=2表示第二页好友) 8 | 提供各自账号列表的friendPin给我 9 | 如果想设置固定好友,那下载下来放到本地使用,可以修改friendPin换好友(助力一好友后,更换一次friendPin里面的内容) 10 | 感谢github @Zero-S1提供 11 | 使用方法: 12 | ①设置好相应软件的重写 13 | ②从京东APP宠汪汪->领狗粮->邀请好友助力,分享给你小号微信或者微信的文件传输助手。 自己再打开刚才的分享,助力成功后,返回到此小程序首页重新进去宠汪汪即可助力下一位好友 14 | ③如提示好友人气旺,说明此好友已满了三人助力,需重新进出小程序,重新进入来客有礼-宠汪汪。 15 | new Env('宠汪汪强制为别人助力');//此处忽略即可,为自动生成iOS端软件配置文件所需 16 | [MITM] 17 | hostname = draw.jdfcloud.com 18 | ======================Surge===================== 19 | [Script] 20 | 宠汪汪强制为别人助力= type=http-request,pattern=^https:\/\/draw\.jdfcloud\.com\/\/common\/pet\/enterRoom\/h5\?invitePin=.*(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?&reqSource=weapp|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin,requires-body=1,max-size=0,script-path=jd_joy_help.js 21 | 22 | ===================Quantumult X===================== 23 | [rewrite_local] 24 | ^https:\/\/draw\.jdfcloud\.com\/\/common\/pet\/enterRoom\/h5\?invitePin=.*(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?&reqSource=weapp|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin url script-request-header jd_joy_help.js 25 | 26 | =====================Loon===================== 27 | [Script] 28 | http-request ^https:\/\/draw\.jdfcloud\.com\/\/common\/pet\/enterRoom\/h5\?invitePin=.*(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?&reqSource=weapp|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin script-path=jd_joy_help.js, requires-body=true, timeout=3600, tag=宠汪汪强制为别人助力 29 | 30 | 31 | 你也可从下面链接拿好友的friendPin(复制链接到有京东ck的浏览器打开即可) 32 | 33 | https://jdjoy.jd.com/pet/getFriends?itemsPerPage=20¤tPage=1 34 | */ 35 | const friendsArr = ["jd_5c214708cbcd7", "jd_45a6b5953b15b", "jd_45a6b5953b15b", "jd_704a2e5e28a66", "jd_66f5cecc1efcd", "jd_sIhNpDXJehOr", "jd_5851f32d4a083", "yhr_19820404", "13008094886_p", "13966269193_p", "jd_4e4d9825e5fb1", "jd_5ff306cf94512", "ququkoko", "jd_59a9823f35496", "529577509-275616", "18923155789_p", "jd_455da88071d1e", "dreamscometrue5120", "蒋周南19620607", "jd_620ceca400151", "杉雨2011", "MARYMY88", "13682627696_p", "jd_6777ee65f9fcc", "夏海东12315", "jd_437b4f3fa5d83", "zyjyc9998", "meoygua", "MLHK7288", "jd_42d9ce3001acd", "jd_57650a30ef6eb", "jd_44ca1016e0f96", "jd_74332d1d62a97", "jd_7dbe4f8a40a7d", "jd_4fa238e4e3039", "elbereth1122", "jd_4d9be23908e41", "jd_51f0d43d78900", "13588108107_p", "123by456", "09niuniuma", "143798682-947527", "jd_560c6f30e6951", "jd_54ddb8af5374a", "夏革平", "247466310", "wang2011", "chensue", "1362245003-624122", "wdGefYCBlyOuvz", "jd_412f7eb363cd8", "18311575050_p", "1307976-34738981", "wdgOGLtOJjjbnp", "klhzdx", "jd_5fdcdcb183d7d", "jd_5862fd8834680", "jd_51a64a9da6b94", "302990512-553401", "jd_4078f69a72873", "jd_ewYCRdmukzQH", "13348822441_p", "hlcx86021", "390823571-784974", "jd_79af2bc7a56a3", "15053231812_p", "jd_6f53253d117c5", "jd_5bf29dffa62ea", "jd_47a1c4ad02103", "刘凤苓", "145391572-102667", "yanglan0409", "jd_4b8a70f3b06c3", "弑神X", "jd_59d962a076126", "sjw3000", "jd_4d4def8b59787", "L1518235423", "jd_579b891fbea9b", "frank818", "hellohuhua", "jd_4cf1918577871", "jd_akYbyiXqrIDC", "李纪红", "jd_54a4260ca986c", "jd_4cba35cfa8220", "13654075776_p", "13916051043", "jd_6f9b9a6769afb", "iamkgbfox", "jd_5fbda9be54d5b", "jd_76763ba485c5e", "jd_485c757b79422", "xiaojingang_0", "lanye1545", "chenzhiyun2002", "lmpbjs1988", "jd_SmPxpudoGYOb", "jwl19690905", "荷舞弄清影88", "jd_750d6a9734717", "jd_64e37854e713f", "jd_573c9832d8989", "wdkplHVQlgowTW", "wwk232323", "jd_6bfe51f915c90", "我手机号码", "13681610268_p", "ss836580793", "15868005933_p", "zooooo58", "陌上花开花又落", "jd_701f52f8badbb", "jd_462f9229c20e4", "jd_42193689987a0", "jd_7dc5829121bcc", "13656692651_phz", "jd_47f49f22f1dc3", "handechun959", "13775208986_p", "guoyizhang", "jd_677dd20bf2749", "jd_FfAnqFVEoBul", "jd_4e59841cae4f9", "jd_5279d593e7803", "思绪随风2011", "jd_62e335d785872", "suyugen", "jd_4e68b48d16f7b", "jd_56b7a4e092e85", "cocoty", "jd_7b6d6e7dc98f1", "jd_63423cd594e8b", "greatyunyun", "4349小丢丢", "18027486801_p", "15207695569_p", "llbai11", "wdNRUvbJItetlvB", "jd_54154982c707f", "85192cool", "jd_60d497271825b", "greatyunyun9320", "ky252571504", "jd_74e60dbcae365", "wdiicnSbYSHWwE", "jd_529a0a309d418", "jd_7be92b11b7e8f", "13486659225_p", "jd_iFnquhpWWAzO", "jd_6e348ece13e20", "jd_6f5b49bb757cb", "znz传奇", "418001066_m", "jd_67ded5748c3ab", "361372-27819972", "jd_5fafb631c98af", "jd_76dd04e844d63", "小鹿Jenny", "00数字方程式", "jd_77a82b603c6c3", "勇敢的小泪", "jd_4481f68984466", "jd_758f5224ee957", "mwb1992062_m", "15975229552_p", "zdj8341", "pet_virtual_friend_胡皋三", "pet_virtual_friend_绿茶sama", "pet_virtual_friend_Ainio", "jd_4915949b7bfa1", "jd_7ca74ed9224ef", "jd_42764f5ea2341", "5317123-63418293", "jd_40a2d9485cbdb", "qazmcl1230", "jd_7ced325aba4fd", "jd_402fe7425fcaf", "95581245-627991", "luffy-314_m", "jd_BCXgLlmxHdiS", "jd_610b3d00928e5", "你要醒来", "338379384-148135", "pet_virtual_friend_乔治桑", "jd_54130a3e282ea", "jd_6169b3411ed5b", "jd_428d930ca56a5", "qq6924309", "pet_virtual_friend_路遇狗与少年", "jd_712bd3bfd55d6", "jd_4e97fe5ca4003", "tommy_he1", "13981372001_p", "129867657-673064", "jd_525d6e7a57e7c", "wdZuirGekSHKmF", "jd_75e1da74980ab", "jd_RVMXldNSQNOP", "jd_5f94da0265e0d", "jd_67ab629be7e61", "13887490621_p", "jd_4e0d529ba3c35", "jd_493918e314b50", "jd_71a220104187a", "jd_vVhhkdUpTkJQ", "gary388jingdong", "wdjQkAbFobMTyo", "cloud_kim", "jd_558ed75f52d39", "15555448319_p", "wdhxZuEvXhhvCf", "jd_72b940be8c0f4", "congcong炒葱葱", "jd_7eb0de64eb25a", "13209558123_p", "jd_53bf7cb6fb8e6", "jd_4fe620f72fa7c", "夏雨的爱情", "jd_47ba82eb392a5", "jd_LXnFHXoJwXkW", "62160785-578856", "醒醒该睡了", "jd_LOEWgvNwQIWD", "xiiirww", "pet_virtual_friend_特兰克斯", "pet_virtual_friend_Talon", "jd_4f7cd5b108733", "jd_NgNWXMVkJIvk", "jadonglin", "玩家卫弈", "liangxuejingdong", "jd_627171efb7c0a", "jd_53bc7a14f64d6", "15809290902_p", "jd_65a2ab73d9aa5", "jd_6edb943cacbfb", "jd_7f7eabc5caf7d", "jd_725e17effb6a9", "蔡辉煌", "voxb", "gdxx_hhw_m", "jd_78f0d6524a1dc", "jd_sDtnONLeHwfG", "xyyshy1983", "yinlang46", "ypqian", "15817094457_p", "fdxwb", "wuyaoxin2012", "明子溪", "henry1927_m", "chamy99", "jd_461e384274c34", "248358330-645106", "jd_4fd63de4a6033", "蜜糖向日葵", "wonghe", "36453197-121619", "琳琅满目cbb", "jd_5b7cc9e532426", "134795344-89911673", "15211488203_p", "jd_6f1f0722f8365", "jd_JmGCpqgpCtqG", "墨明棋妙陈", "pet_virtual_friend_1314爱澳", "1209815-33190621", "zhouhuayh", "jd_6d3cbb8b0751a", "jd_6e00e826f939b", "mztvip", "davidharry", "sara35424", "sun5025", "jd_62ce2385bb364", "352834026-406289", "pet_virtual_friend_丁座的真爱粉", "jd_582eecf8d27a9", "jd_49acdb02e8514", "13976911784_p", "jd_uGzohbhFpRuz", "wzywolfgang", "yjbonny", "沧海不轮回", "649297742_327799447", "倚兰椒", "琳琳8796", "snzh2013", "jd_73751adc04afd", "wdNnlMzPGJJKgqI", "yygt1158", "jd_53df36eb204a0", "花开花花落", "jd_611e082213c89", "jd_71e77d9235cf5", "jd_596fd9fea411f", "jd_7277d200aa1ac", "15230573701_p", "zb19881021", "692620136落", "168876810-159969", "zhushidan100", "上自习的猪", "15602231009_p", "jd_5213fd3fd5e09", "jd_6711f97ee4dfe", "44787591-640051", "MisterGlasses", "jd_7b22bbfe1e7e5", "138555963-81748582", "jd_QEVVkkDTQAlJ", "4932713-24535180", "jd_6dce98c07a644", "jd_DUtPtiiDamDr", "wangyneu", "wBm1TsDy3p_m", "jd_6acd3a6cc79cc","jd_444f5c020f31c","jd_71caf6b3ec4cb", "shin_dynasty", "carola82", "jd_AOhLSBLdSnux", "ningbormb"] 36 | /** 37 | * 生成随机数字 38 | * @param {number} min 最小值(包含) 39 | * @param {number} max 最大值(不包含) 40 | */ 41 | let newUrl, url = $request.url; 42 | function randomNumber(min = 0, max = 100) { 43 | return Math.min(Math.floor(min + Math.random() * (max - min)), max); 44 | } 45 | try { 46 | console.log(`url:${url}`); 47 | let friendPin = encodeURI(friendsArr[randomNumber(0, friendsArr.length)]) //强制为对方助力,可成为好友关系 48 | const timestamp = new Date().getTime() 49 | const lks = url.match(/lks=.*?$/g)[0]; 50 | newUrl = url.replace(/friendPin=.*?$/i, "friendPin=" + friendPin).replace(/invitePin=.*?$/i, "invitePin=" + friendPin).replace(/inviteTimeStamp=.*?$/i, "inviteTimeStamp=" + timestamp + "&") 51 | newUrl += `&${lks}`; 52 | console.log(`newUrl:${newUrl}`); 53 | } catch (e) { 54 | console.log(e); 55 | } finally { 56 | $done({ url: newUrl }) 57 | } 58 | -------------------------------------------------------------------------------- /jd_kd.js: -------------------------------------------------------------------------------- 1 | /* 2 | 京东快递签到 3 | 活动入口:https://jingcai-h5.jd.com/#/ 4 | 签到领豆,14天内满4次和7次享额外奖励,每天运行一次即可 5 | 更新地址:jd_kd.js 6 | 7 | 已支持IOS双京东账号, Node.js支持N个京东账号 8 | 脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js 9 | ============Quantumultx=============== 10 | [task_local] 11 | #京东快递签到 12 | 10 0 * * * jd_kd.js, tag=京东快递签到, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_kd.png, enabled=true 13 | 14 | ================Loon============== 15 | [Script] 16 | cron "10 0 * * *" script-path=jd_kd.js, tag=京东快递签到 17 | 18 | ===============Surge================= 19 | 京东快递签到 = type=cron,cronexp="10 0 * * *",wake-system=1,timeout=3600,script-path=jd_kd.js 20 | 21 | ============小火箭========= 22 | 京东快递签到 = type=cron,script-path=jd_kd.js, cronexpr="10 0 * * *", timeout=3600, enable=true 23 | */ 24 | const $ = new Env('京东快递签到'); 25 | 26 | const notify = $.isNode() ? require('./sendNotify') : ''; 27 | //Node.js用户请在jdCookie.js处填写京东ck; 28 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 29 | let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送 30 | const randomCount = $.isNode() ? 20 : 5; 31 | //IOS等用户直接用NobyDa的jd cookie 32 | let cookiesArr = [], cookie = '', message, allMsg = ''; 33 | if ($.isNode()) { 34 | Object.keys(jdCookieNode).forEach((item) => { 35 | cookiesArr.push(jdCookieNode[item]) 36 | }) 37 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 38 | } else { 39 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); 40 | } 41 | const JD_API_HOST = 'https://api.m.jd.com/api'; 42 | !(async () => { 43 | if (!cookiesArr[0]) { 44 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 45 | return; 46 | } 47 | for (let i = 0; i < cookiesArr.length; i++) { 48 | if (cookiesArr[i]) { 49 | cookie = cookiesArr[i]; 50 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 51 | $.index = i + 1; 52 | $.isLogin = true; 53 | $.nickName = ''; 54 | message = ''; 55 | await TotalBean(); 56 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); 57 | if (!$.isLogin) { 58 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 59 | 60 | if ($.isNode()) { 61 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 62 | } 63 | continue 64 | } 65 | await userSignIn(); 66 | // await showMsg(); 67 | } 68 | } 69 | if (allMsg) { 70 | $.msg($.name, '', allMsg); 71 | } 72 | })() 73 | .catch((e) => { 74 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') 75 | }) 76 | .finally(() => { 77 | $.done(); 78 | }) 79 | 80 | function showMsg() { 81 | return new Promise(resolve => { 82 | $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`); 83 | resolve() 84 | }) 85 | } 86 | function userSignIn() { 87 | return new Promise(resolve => { 88 | $.post(taskUrl(), (err, resp, data) => { 89 | try { 90 | if (err) { 91 | console.log(`${JSON.stringify(err)}`) 92 | console.log(resp) 93 | console.log(`${$.name} API请求失败,请检查网路重试`) 94 | } else { 95 | if (safeGet(data)) { 96 | data = JSON.parse(data); 97 | if (data.code === 1) { 98 | console.log(`今日签到成功,获得${data.content[0].title}`) 99 | message += `京东账号${$.index}${$.nickName}\n今日签到成功,获得${data.content[0].title} 🐶\n`; 100 | allMsg += message; 101 | } else if (data.code === -1) { 102 | console.log(`今日已签到`) 103 | // message += `【签到】失败,今日已签到`; 104 | } else { 105 | console.log(`异常:${JSON.stringify(data)}`) 106 | } 107 | } 108 | } 109 | } catch (e) { 110 | $.logErr(e, resp) 111 | } finally { 112 | resolve(); 113 | } 114 | }) 115 | }) 116 | } 117 | function taskUrl() { 118 | return { 119 | url: `https://lop-proxy.jd.com/jiFenApi/signInAndGetReward`, 120 | body: '[{"userNo":"$cooMrdGatewayUid$"}]', 121 | headers: { 122 | 'Host': 'lop-proxy.jd.com', 123 | 'lop-dn': 'jingcai.jd.com', 124 | 'biz-type': 'service-monitor', 125 | 'app-key': 'jexpress', 126 | 'access': 'H5', 127 | 'content-type': 'application/json;charset=utf-8', 128 | 'clientinfo': '{"appName":"jingcai","client":"m"}', 129 | 'accept': 'application/json, text/plain, */*', 130 | 'jexpress-report-time': '1607330170578', 131 | 'x-requested-with': 'XMLHttpRequest', 132 | 'source-client': '2', 133 | 'appparams': '{"appid":158,"ticket_type":"m"}', 134 | 'version': '1.0.0', 135 | 'origin': 'https://jingcai-h5.jd.com', 136 | 'sec-fetch-site': 'same-site', 137 | 'sec-fetch-mode': 'cors', 138 | 'sec-fetch-dest': 'empty', 139 | 'referer': 'https://jingcai-h5.jd.com/', 140 | 'accept-language': 'zh-CN,zh;q=0.9', 141 | "Cookie": cookie, 142 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), 143 | } 144 | } 145 | } 146 | function TotalBean() { 147 | return new Promise(async resolve => { 148 | const options = { 149 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, 150 | "headers": { 151 | "Accept": "application/json,text/plain, */*", 152 | "Content-Type": "application/x-www-form-urlencoded", 153 | "Accept-Encoding": "gzip, deflate, br", 154 | "Accept-Language": "zh-cn", 155 | "Connection": "keep-alive", 156 | "Cookie": cookie, 157 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", 158 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 159 | } 160 | } 161 | $.post(options, (err, resp, data) => { 162 | try { 163 | if (err) { 164 | console.log(`${JSON.stringify(err)}`) 165 | console.log(`${$.name} API请求失败,请检查网路重试`) 166 | } else { 167 | if (data) { 168 | data = JSON.parse(data); 169 | if (data['retcode'] === 13) { 170 | $.isLogin = false; //cookie过期 171 | return 172 | } 173 | if (data['retcode'] === 0) { 174 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName; 175 | } else { 176 | $.nickName = $.UserName 177 | } 178 | } else { 179 | console.log(`京东服务器返回空数据`) 180 | } 181 | } 182 | } catch (e) { 183 | $.logErr(e, resp) 184 | } finally { 185 | resolve(); 186 | } 187 | }) 188 | }) 189 | } 190 | function safeGet(data) { 191 | try { 192 | if (typeof JSON.parse(data) == "object") { 193 | return true; 194 | } 195 | } catch (e) { 196 | console.log(e); 197 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 198 | return false; 199 | } 200 | } 201 | function jsonParse(str) { 202 | if (typeof str == "string") { 203 | try { 204 | return JSON.parse(str); 205 | } catch (e) { 206 | console.log(e); 207 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 208 | return []; 209 | } 210 | } 211 | } 212 | // prettier-ignore 213 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 214 | -------------------------------------------------------------------------------- /jd_market_lottery.js: -------------------------------------------------------------------------------- 1 | // author: 疯疯 2 | /* 3 | 幸运大转盘 4 | 活动地址:https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html 5 | 脚本兼容: Quantumult X, Surge, Loon, JSBox, Node.js 6 | ==============Quantumult X============== 7 | [task_local] 8 | #幸运大转盘 9 | 4 10 * * * jd_market_lottery.js, tag=幸运大转盘, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true 10 | 11 | ==============Loon============== 12 | [Script] 13 | cron "4 10 * * *" script-path=jd_market_lottery.js,tag=幸运大转盘 14 | 15 | ================Surge=============== 16 | 幸运大转盘 = type=cron,cronexp="4 10 * * *",wake-system=1,timeout=3600,script-path=jd_market_lottery.js 17 | 18 | ===============小火箭========== 19 | 幸运大转盘 = type=cron,script-path=jd_market_lottery.js, cronexpr="4 10 * * *", timeout=3600, enable=true 20 | */ 21 | 22 | const $ = new Env("幸运大转盘"); 23 | const jdCookieNode = $.isNode() ? require("./jdCookie.js") : ""; 24 | let cookiesArr = [], 25 | cookie = "", 26 | allMsg = ''; 27 | 28 | if ($.isNode()) { 29 | Object.keys(jdCookieNode).forEach((item) => { 30 | cookiesArr.push(jdCookieNode[item]); 31 | }); 32 | console.log(`如果出现提示 ?.data. 错误,请升级nodejs版本(进入容器后,apk add nodejs-current)`) 33 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {}; 34 | } else { 35 | cookiesArr = [ 36 | $.getdata("CookieJD"), 37 | $.getdata("CookieJD2"), 38 | ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item); 39 | } 40 | const JD_API_HOST = "https://api.m.jd.com/client.action"; 41 | !(async () => { 42 | if (!cookiesArr[0]) { 43 | $.msg( 44 | $.name, 45 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", 46 | "https://bean.m.jd.com/", 47 | {"open-url": "https://bean.m.jd.com/"} 48 | ); 49 | return; 50 | } 51 | for (let i = 0; i < cookiesArr.length; i++) { 52 | if (cookiesArr[i]) { 53 | cookie = cookiesArr[i]; 54 | $.UserName = decodeURIComponent( 55 | cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1] 56 | ); 57 | $.index = i + 1; 58 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`); 59 | await main() 60 | } 61 | } 62 | await showMsg() 63 | })() 64 | .catch((e) => { 65 | $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, ""); 66 | }) 67 | .finally(() => { 68 | $.done(); 69 | }); 70 | function showMsg() { 71 | return new Promise(async resolve => { 72 | if (allMsg) $.msg($.name, '', allMsg); 73 | resolve(); 74 | }) 75 | } 76 | async function main() { 77 | await getInfo('https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html') 78 | await getInfo('https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html') 79 | } 80 | async function getInfo(url) { 81 | return new Promise(resolve=>{ 82 | $.get({ 83 | url, 84 | headers:{ 85 | "Cookie": cookie, 86 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 87 | } 88 | },async (err,resp,data)=>{ 89 | try{ 90 | if(err){ 91 | 92 | }else{ 93 | data = $.toObj(data.match(/window.__react_data__ = (\{.*\})/)[1]) 94 | let taskList = data?.activityData?.floorList?.filter(vo=>vo.template==='score_task')[0] 95 | //console.log(data?.activityData?.floorList) 96 | for(let vo of taskList['taskItemList']){ 97 | for(let i = vo.joinTimes; i< vo.taskLimit;++i){ 98 | console.log(`去完成${vo?.flexibleData?.taskName ?? vo.enAwardK}任务,第${i+1}次`) 99 | await doTask(vo.enAwardK) 100 | await $.wait(500) 101 | } 102 | } 103 | let lottery = data?.activityData?.floorList?.filter(vo=>vo.template==='choujiang_wheel')[0] 104 | //console.log(lottery) 105 | const {userScore,lotteryScore} = lottery.lotteryGuaGuaLe 106 | if(lotteryScore<=userScore) { 107 | console.log(`抽奖需要${lotteryScore},当前${userScore}分,去抽奖`) 108 | await doLottery("a84f9428da0bb36a6a11884c54300582") 109 | } else { 110 | console.log(`当前积分已不足去抽奖`) 111 | } 112 | } 113 | }catch (e) { 114 | 115 | }finally { 116 | resolve() 117 | } 118 | 119 | }) 120 | }) 121 | } 122 | function doTask(enAwardK) { 123 | return new Promise(resolve => { 124 | $.post(taskUrl('babelDoScoreTask',{enAwardK,"isQueryResult":0,"siteClient":"apple","mitemAddrId":"","geo":{"lng":"","lat":""},"addressId":"","posLng":"","posLat":"","homeLng":"","homeLat":"","focus":"","innerAnchor":"","cv":"2.0"}), 125 | (err,resp,data)=>{ 126 | try{ 127 | if(err){ 128 | 129 | }else{ 130 | data = $.toObj(data) 131 | console.log(data.promptMsg) 132 | } 133 | }catch (e) { 134 | 135 | }finally { 136 | resolve() 137 | } 138 | }) 139 | }) 140 | } 141 | function doLottery(enAwardK,authType="2") { 142 | return new Promise(resolve => { 143 | $.post(taskUrl('babelGetLottery',{enAwardK,authType}), 144 | (err,resp,data)=>{ 145 | try{ 146 | if(err){ 147 | 148 | }else{ 149 | data = $.toObj(data) 150 | console.log(data.promptMsg) 151 | allMsg += `【京东账号${$.index}】${$.UserName}:${data.promptMsg}\n` 152 | } 153 | }catch (e) { 154 | 155 | }finally { 156 | resolve() 157 | } 158 | }) 159 | }) 160 | } 161 | function taskUrl(function_id, body = {}) { 162 | return { 163 | url: `${JD_API_HOST}/client.action?functionId=${function_id}`, 164 | body: `body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0`, 165 | headers: { 166 | "Cookie": cookie, 167 | "origin": "https://h5.m.jd.com", 168 | "referer": "https://h5.m.jd.com/", 169 | 'Content-Type': 'application/x-www-form-urlencoded', 170 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 171 | } 172 | } 173 | } 174 | 175 | function safeGet(data) { 176 | try { 177 | if (typeof JSON.parse(data) == "object") { 178 | return true; 179 | } 180 | } catch (e) { 181 | console.log(e); 182 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 183 | return false; 184 | } 185 | } 186 | 187 | // prettier-ignore 188 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 189 | -------------------------------------------------------------------------------- /jd_qjd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: JD-Script / jd_qjd 5 | Author: Curtin 6 | 功能:全民抢京豆(7.2-7.15):https://h5.m.jd.com/rn/3MQXMdRUTeat9xqBSZDSCCAE9Eqz/index.html?has_native=0 7 | 满160豆需要20人助力,每个用户目前只能助力2次不同的用户。 8 | Date: 2021/7/3 上午10:02 9 | TG交流 https://t.me/topstyle996 10 | TG频道 https://t.me/TopStyle2021 11 | update: 2021.7.4 08:36 12 | * 修复了助力活动不存在、增加了随机UA(如果未定义ua则启用随机UA) 13 | 14 | ''' 15 | 16 | #ck 优先读取【JDCookies.txt】 文件内的ck 再到 ENV的 变量 JD_COOKIE='ck1&ck2' 最后才到脚本内 cookies=ck 17 | cookies = '' 18 | qjd_zlzh = ['Your JD_User', '买买买'] 19 | 20 | # 建议调整一下的参数 21 | # UA 可自定义你的,注意格式: jdapp;iPhone;10.0.4;13.1.1;93b4243eeb1af72d142991d85cba75c66873dca5;network/wifi;ADID/8679C062-A41A-4A25-88F1-50A7A3EEF34A;model/iPhone13,1;addressid/3723896896;appBuild/167707;jdSupportDarkMode/0 22 | UserAgent = '' 23 | # 限制速度 (秒) 24 | sleepNum = 0.1 25 | 26 | import os, re 27 | import random, string 28 | try: 29 | import requests 30 | except Exception as e: 31 | print(e, "\n缺少requests 模块,请执行命令安装:python3 -m pip install requests") 32 | exit(3) 33 | from urllib.parse import unquote, quote 34 | import json 35 | import time 36 | requests.packages.urllib3.disable_warnings() 37 | 38 | ss = requests.session() 39 | 40 | pwd = os.path.dirname(os.path.abspath(__file__)) + os.sep 41 | t = time.time() 42 | aNum = 0 43 | beanCount = 0 44 | userCount = {} 45 | 46 | class getJDCookie(object): 47 | # 适配各种平台环境ck 48 | def getckfile(self): 49 | if os.path.exists(pwd + 'JDCookies.txt'): 50 | return pwd + 'JDCookies.txt' 51 | elif os.path.exists('/ql/config/env.sh'): 52 | print("当前环境青龙面板新版") 53 | return '/ql/config/env.sh' 54 | elif os.path.exists('/ql/config/cookie.sh'): 55 | print("当前环境青龙面板旧版") 56 | return '/ql/config/env.sh' 57 | elif os.path.exists('/jd/config/config.sh'): 58 | print("当前环境V4") 59 | return '/jd/config/config.sh' 60 | elif os.path.exists(pwd + 'JDCookies.txt'): 61 | return pwd + 'JDCookies.txt' 62 | return pwd + 'JDCookies.txt' 63 | 64 | # 获取cookie 65 | def getCookie(self): 66 | global cookies 67 | ckfile = self.getckfile() 68 | try: 69 | if os.path.exists(ckfile): 70 | with open(ckfile, "r", encoding="utf-8") as f: 71 | cks = f.read() 72 | f.close() 73 | if 'pt_key=' in cks and 'pt_pin=' in cks: 74 | r = re.compile(r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I) 75 | cks = r.findall(cks) 76 | if len(cks) > 0: 77 | if 'JDCookies.txt' in ckfile: 78 | print("当前获取使用 JDCookies.txt 的cookie") 79 | cookies = '' 80 | for i in cks: 81 | cookies += i 82 | return 83 | else: 84 | with open(pwd + 'JDCookies.txt', "w", encoding="utf-8") as f: 85 | cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" 86 | f.write(cks) 87 | f.close() 88 | if "JD_COOKIE" in os.environ: 89 | if len(os.environ["JD_COOKIE"]) > 10: 90 | cookies = os.environ["JD_COOKIE"] 91 | print("已获取并使用Env环境 Cookie") 92 | except Exception as e: 93 | print(f"【getCookie Error】{e}") 94 | 95 | # 检测cookie格式是否正确 96 | def getUserInfo(self, ck, pinName, userNum): 97 | url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion?orgFlag=JD_PinGou_New&callSource=mainorder&channel=4&isHomewhite=0&sceneval=2&sceneval=2&callback=GetJDUserInfoUnion' 98 | headers = { 99 | 'Cookie': ck, 100 | 'Accept': '*/*', 101 | 'Connection': 'close', 102 | 'Referer': 'https://home.m.jd.com/myJd/home.action', 103 | 'Accept-Encoding': 'gzip, deflate, br', 104 | 'Host': 'me-api.jd.com', 105 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1', 106 | 'Accept-Language': 'zh-cn' 107 | } 108 | try: 109 | resp = requests.get(url=url, verify=False, headers=headers, timeout=60).text 110 | r = re.compile(r'GetJDUserInfoUnion.*?\((.*?)\)') 111 | result = r.findall(resp) 112 | userInfo = json.loads(result[0]) 113 | nickname = userInfo['data']['userInfo']['baseInfo']['nickname'] 114 | return ck, nickname 115 | except Exception: 116 | context = f"账号{userNum}【{pinName}】Cookie 已失效!请重新获取。" 117 | print(context) 118 | return ck, False 119 | 120 | def iscookie(self): 121 | """ 122 | :return: cookiesList,userNameList,pinNameList 123 | """ 124 | cookiesList = [] 125 | userNameList = [] 126 | pinNameList = [] 127 | if 'pt_key=' in cookies and 'pt_pin=' in cookies: 128 | r = re.compile(r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I) 129 | result = r.findall(cookies) 130 | if len(result) >= 1: 131 | print("您已配置{}个账号".format(len(result))) 132 | u = 1 133 | for i in result: 134 | r = re.compile(r"pt_pin=(.*?);") 135 | pinName = r.findall(i) 136 | pinName = unquote(pinName[0]) 137 | # 获取账号名 138 | ck, nickname = self.getUserInfo(i, pinName, u) 139 | if nickname != False: 140 | cookiesList.append(ck) 141 | userNameList.append(nickname) 142 | pinNameList.append(pinName) 143 | else: 144 | u += 1 145 | continue 146 | u += 1 147 | if len(cookiesList) > 0 and len(userNameList) > 0: 148 | return cookiesList, userNameList, pinNameList 149 | else: 150 | print("没有可用Cookie,已退出") 151 | exit(3) 152 | else: 153 | print("cookie 格式错误!...本次操作已退出") 154 | exit(4) 155 | else: 156 | print("cookie 格式错误!...本次操作已退出") 157 | exit(4) 158 | getCk = getJDCookie() 159 | getCk.getCookie() 160 | 161 | if "qjd_zlzh" in os.environ: 162 | if len(os.environ["qjd_zlzh"]) > 1: 163 | qjd_zlzh = os.environ["qjd_zlzh"] 164 | qjd_zlzh = qjd_zlzh.replace('[', '').replace(']', '').replace('\'', '').replace(' ', '').split(',') 165 | print("已获取并使用Env环境 qjd_zlzh:", qjd_zlzh) 166 | 167 | def userAgent(): 168 | """ 169 | 随机生成一个UA 170 | :return: 171 | """ 172 | if not UserAgent: 173 | uuid = ''.join(random.sample('123456789abcdef123456789abcdef123456789abcdef123456789abcdef', 40)) 174 | iosVer = ''.join(random.sample(["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1)) 175 | iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1)) 176 | return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/8679C062-A41A-4A25-88F1-50A7A3EEF34A;model/iPhone{iPhone},1;addressid/3723896896;appBuild/167707;jdSupportDarkMode/0' 177 | else: 178 | return UserAgent 179 | 180 | def getShareCode(ck): 181 | global aNum 182 | try: 183 | v_num1 = ''.join(random.sample(["1", "2", "3", "4", "5", "6", "7", "8", "9"], 1)) + ''.join(random.sample(string.digits, 4)) 184 | url = 'https://api.m.jd.com/client.action?functionId=signBeanGroupStageIndex&body=%7B%22monitor_refer%22%3A%22%22%2C%22rnVersion%22%3A%223.9%22%2C%22fp%22%3A%22-1%22%2C%22shshshfp%22%3A%22-1%22%2C%22shshshfpa%22%3A%22-1%22%2C%22referUrl%22%3A%22-1%22%2C%22userAgent%22%3A%22-1%22%2C%22jda%22%3A%22-1%22%2C%22monitor_source%22%3A%22bean_m_bean_index%22%7D&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=&jsonp=jsonp_' + str(int(round(t * 1000))) + '_' + v_num1 185 | head = { 186 | 'Cookie': ck, 187 | 'Accept': '*/*', 188 | 'Connection': 'keep-alive', 189 | 'Referer': 'https://h5.m.jd.com/rn/3MQXMdRUTeat9xqBSZDSCCAE9Eqz/index.html?has_native=0', 190 | 'Accept-Encoding': 'gzip, deflate, br', 191 | 'Host': 'api.m.jd.com', 192 | # 'User-Agent': 'Mozilla/5.0 (iPhone CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1', 193 | 'User-Agent': userAgent(), 194 | 'Accept-Language': 'zh-cn' 195 | } 196 | requests.get(url='https://h5.m.jd.com/rn/3MQXMdRUTeat9xqBSZDSCCAE9Eqz/index.html?has_native=0&tttparams=&lng=&lat=&sid=&un_area=', headers=head, verify=False, timeout=30) 197 | resp = requests.get(url=url, headers=head, verify=False, timeout=30).text 198 | r = re.compile(r'jsonp_.*?\((.*?)\)\;', re.M | re.S | re.I) 199 | result = r.findall(resp) 200 | jsonp = json.loads(result[0]) 201 | try: 202 | groupCode = jsonp['data']['groupCode'] 203 | shareCode = jsonp['data']['shareCode'] 204 | activityId = jsonp['data']['activityMsg']['activityId'] 205 | sumBeanNumStr = int(jsonp['data']['sumBeanNumStr']) 206 | except: 207 | if aNum < 5: 208 | aNum += 1 209 | return getShareCode(ck) 210 | else: 211 | groupCode = 0 212 | shareCode = 0 213 | sumBeanNumStr = 0 214 | aNum = 0 215 | activityId = 0 216 | aNum = 0 217 | return groupCode, shareCode, sumBeanNumStr, activityId 218 | except Exception as e: 219 | print(f"getShareCode Error", e) 220 | 221 | def helpCode(ck, groupCode, shareCode,u, unum, user, activityId): 222 | try: 223 | v_num1 = ''.join(random.sample(["1", "2", "3", "4", "5", "6", "7", "8", "9"], 1)) + ''.join(random.sample(string.digits, 4)) 224 | headers = { 225 | 'Cookie': ck, 226 | 'Accept': '*/*', 227 | 'Connection': 'keep-alive', 228 | 'Referer': f'https://h5.m.jd.com/rn/42yjy8na6pFsq1cx9MJQ5aTgu3kX/index.html?jklActivityId=115&source=SignSuccess&jklGroupCode={groupCode}&ad_od=1&jklShareCode={shareCode}', 229 | 'Accept-Encoding': 'gzip, deflate, br', 230 | 'Host': 'api.m.jd.com', 231 | 'User-Agent': userAgent(), 232 | 'Accept-Language': 'zh-cn' 233 | } 234 | url = 'https://api.m.jd.com/client.action?functionId=signGroupHelp&body=%7B%22activeType%22%3A2%2C%22groupCode%22%3A%22' + str(groupCode) + '%22%2C%22shareCode%22%3A%22' + shareCode + f'%22%2C%22activeId%22%3A%22{activityId}%22%2C%22source%22%3A%22guest%22%7D&appid=ld&client=apple&clientVersion=10.0.4&networkType=wifi&osVersion=13.7&uuid=&openudid=&jsonp=jsonp_{int(round(t * 1000))}_{v_num1}' 235 | resp = requests.get(url=url, headers=headers, verify=False, timeout=30).text 236 | r = re.compile(r'jsonp_.*?\((.*?)\)\;', re.M | re.S | re.I) 237 | result = r.findall(resp) 238 | jsonp = json.loads(result[0]) 239 | helpToast = jsonp['data']['helpToast'] 240 | pageFlag = jsonp['data']['pageFlag'] 241 | if pageFlag == 0: 242 | print(f"账号{unum}【{u}】助力失败! 原因:{helpToast}") 243 | if '满' in helpToast: 244 | print(f"## 恭喜账号【{user}】团已满,今日累计获得160豆") 245 | return True 246 | return False 247 | else: 248 | if '火' in helpToast: 249 | print(f"账号{unum}【{u}】助力失败! 原因:{helpToast}") 250 | else: 251 | print(f"账号{unum}【{u}】{helpToast} , 您也获得1豆哦~") 252 | return False 253 | except Exception as e: 254 | print(f"helpCode Error ", e) 255 | 256 | def start(): 257 | print("### 全民抢京豆-助力 ###") 258 | global cookiesList, userNameList, pinNameList, ckNum, beanCount, userCount 259 | cookiesList, userNameList, pinNameList = getCk.iscookie() 260 | for ckname in qjd_zlzh: 261 | try: 262 | ckNum = userNameList.index(ckname) 263 | except Exception as e: 264 | try: 265 | ckNum = pinNameList.index(ckname) 266 | except: 267 | print(f"请检查被助力账号【{ckname}】名称是否正确?提示:助力名字可填pt_pin的值、也可以填账号名。") 268 | continue 269 | 270 | print(f"### 开始助力账号【{userNameList[int(ckNum)]}】###") 271 | groupCode, shareCode, sumBeanNumStr, activityId = getShareCode(cookiesList[ckNum]) 272 | if groupCode == 0: 273 | print(f"## {userNameList[int(ckNum)]} 获取互助码失败。请稍后再试!") 274 | continue 275 | u = 0 276 | for i in cookiesList: 277 | if i == cookiesList[ckNum]: 278 | u += 1 279 | continue 280 | result = helpCode(i, groupCode, shareCode, userNameList[u], u+1, userNameList[int(ckNum)], activityId) 281 | time.sleep(sleepNum) 282 | if result: 283 | break 284 | u += 1 285 | groupCode, shareCode, sumBeanNumStr, activityId = getShareCode(cookiesList[ckNum]) 286 | userCount[f'{userNameList[ckNum]}'] = sumBeanNumStr 287 | beanCount += sumBeanNumStr 288 | print("\n-------------------------") 289 | for i in userCount.keys(): 290 | print(f"账号【{i}】已抢京豆: {userCount[i]}") 291 | print(f"## 今日累计获得 {beanCount} 京豆") 292 | 293 | 294 | if __name__ == '__main__': 295 | start() -------------------------------------------------------------------------------- /jd_zjd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -* 3 | ''' 4 | 项目名称: JD-Script / jd_zjd 5 | Author: Curtin 6 | 功能:微信小程序-赚京豆-瓜分10亿京豆自动助力,默认给账号1助力,多账号才能玩~ 7 | Date: 2021/6/25 下午9:16 8 | TG交流 https://t.me/topstyle996 9 | TG频道 https://t.me/TopStyle2021 10 | updateTime: 2021.6.26 8:34 11 | ''' 12 | 13 | ##### 14 | #ck 优先读取ENV的 变量 JD_COOKIE='ck1&ck2' 再到 【JDCookies.txt】 文件内的ck 最后才到脚本内 cookies=ck 15 | cookies='' 16 | #助力账号,如给账号1 2 10助力,则填 zlzh = [1,2,10] ,支持ENV export zlzh=[1,2,10] 17 | zlzh = [1, ] 18 | ##### 19 | 20 | 21 | 22 | import os, re 23 | import requests 24 | from urllib.parse import unquote 25 | import json 26 | import time 27 | requests.packages.urllib3.disable_warnings() 28 | t = time.time() 29 | aNum = 0 30 | 31 | def getCookie(): 32 | global cookies 33 | pwd = os.path.dirname(os.path.abspath(__file__)) + os.sep 34 | ckfile = pwd + 'JDCookies.txt' 35 | try: 36 | if os.path.exists(ckfile): 37 | with open(ckfile, "r", encoding="utf-8") as f: 38 | cks = f.read() 39 | f.close() 40 | if 'pt_key=' in cks and 'pt_pin=' in cks: 41 | r = re.compile(r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I) 42 | cks = r.findall(cks) 43 | if len(cks) > 0: 44 | cookies = '' 45 | for i in cks: 46 | cookies += i 47 | else: 48 | with open(ckfile, "w", encoding="utf-8") as f: 49 | cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" 50 | f.write(cks) 51 | f.close() 52 | pass 53 | except Exception as e: 54 | print(f"【getCookie Error】{e}") 55 | getCookie() 56 | # 获取系统ENV环境参数优先使用 适合Ac、云服务等环境 57 | # JD_COOKIE=cookie (多账号&分隔) 58 | if "JD_COOKIE" in os.environ: 59 | if len(os.environ["JD_COOKIE"]) > 10: 60 | cookies = os.environ["JD_COOKIE"] 61 | print("已获取并使用Env环境 Cookie") 62 | # JD_COOKIE=cookie (多账号&分隔) 63 | if "zlzh" in os.environ: 64 | if len(os.environ["zlzh"]) > 1: 65 | zlzh = os.environ["zlzh"] 66 | zlzh = zlzh.replace('[', '').replace(']', '').split(',') 67 | print("已获取并使用Env环境 zlzh") 68 | 69 | 70 | # 检测cookie格式是否正确 71 | def getUserInfo(ck, pinName, userNum): 72 | url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion?orgFlag=JD_PinGou_New&callSource=mainorder&channel=4&isHomewhite=0&sceneval=2&sceneval=2&callback=GetJDUserInfoUnion' 73 | headers = { 74 | 'Cookie': ck, 75 | 'Accept': '*/*', 76 | 'Connection': 'close', 77 | 'Referer': 'https://home.m.jd.com/myJd/home.action', 78 | 'Accept-Encoding': 'gzip, deflate, br', 79 | 'Host': 'me-api.jd.com', 80 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1', 81 | 'Accept-Language': 'zh-cn' 82 | } 83 | try: 84 | resp = requests.get(url=url, verify=False, headers=headers, timeout=60).text 85 | r = re.compile(r'GetJDUserInfoUnion.*?\((.*?)\)') 86 | result = r.findall(resp) 87 | userInfo = json.loads(result[0]) 88 | nickname = userInfo['data']['userInfo']['baseInfo']['nickname'] 89 | return ck, nickname 90 | except Exception: 91 | context = f"账号{userNum}【{pinName}】Cookie 已失效!请重新获取。" 92 | print(context) 93 | return ck, False 94 | def iscookie(): 95 | """ 96 | :return: cookiesList,userNameList,pinNameList 97 | """ 98 | cookiesList = [] 99 | userNameList = [] 100 | pinNameList = [] 101 | if 'pt_key=' in cookies and 'pt_pin=' in cookies: 102 | r = re.compile(r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I) 103 | result = r.findall(cookies) 104 | if len(result) >= 1: 105 | print("您已配置{}个账号".format(len(result))) 106 | u = 1 107 | for i in result: 108 | r = re.compile(r"pt_pin=(.*?);") 109 | pinName = r.findall(i) 110 | pinName = unquote(pinName[0]) 111 | # 获取账号名 112 | ck, nickname = getUserInfo(i, pinName, u) 113 | if nickname != False: 114 | cookiesList.append(ck) 115 | userNameList.append(nickname) 116 | pinNameList.append(pinName) 117 | else: 118 | u += 1 119 | continue 120 | u += 1 121 | if len(cookiesList) > 0 and len(userNameList) > 0: 122 | return cookiesList, userNameList, pinNameList 123 | else: 124 | print("没有可用Cookie,已退出") 125 | exit(3) 126 | else: 127 | print("cookie 格式错误!...本次操作已退出") 128 | exit(4) 129 | else: 130 | print("cookie 格式错误!...本次操作已退出") 131 | exit(4) 132 | 133 | # 开启助力任务 134 | def starAssist(sid, headers): 135 | global aNum 136 | try: 137 | timestamp = int(round(t * 1000)) 138 | url = 'https://api.m.jd.com/api?functionId=vvipclub_distributeBean_startAssist&body={%22activityIdEncrypted%22:%22' + sid + '%22,%22channel%22:%22FISSION_BEAN%22}&appid=swat_miniprogram&client=tjj_m&screen=1920*1080&osVersion=5.0.0&networkType=wifi&sdkName=orderDetail&sdkVersion=1.0.0&clientVersion=3.1.3&area=11&fromType=wxapp×tamp=' + str(timestamp) 139 | resp = requests.get(url=url, headers=headers, verify=False, timeout=30).json() 140 | # if resp['success']: 141 | # print(resp) 142 | aNum = 0 143 | except Exception as e: 144 | if aNum < 5: 145 | aNum += 1 146 | return starAssist(sid, headers) 147 | else: 148 | print("starAssist Error", e) 149 | exit(1) 150 | 151 | 152 | #获取助力码 153 | def getShareCode(headers): 154 | global assistStartRecordId, encPin, sid, aNum 155 | try: 156 | url = f'https://api.m.jd.com/api?functionId=distributeBeanActivityInfo&fromType=wxapp×tamp={int(round(t * 1000))}' 157 | body = 'body=%7B%22paramData%22%3A%7B%22channel%22%3A%22FISSION_BEAN%22%7D%7D&appid=swat_miniprogram&client=tjj_m&screen=1920*1080&osVersion=5.0.0&networkType=wifi&sdkName=orderDetail&sdkVersion=1.0.0&clientVersion=3.1.3&area=11' 158 | responses = requests.post(url, headers=headers, data=body, verify=False, timeout=30).json() 159 | if responses['success']: 160 | data = responses['data'] 161 | assistStartRecordId = data['assistStartRecordId'] 162 | encPin = data['encPin'] 163 | sid = data['id'] 164 | aNum = 0 165 | return assistStartRecordId, encPin, sid 166 | except Exception as e: 167 | if aNum < 5: 168 | aNum += 1 169 | return getShareCode(headers) 170 | else: 171 | print("getShareCode Error", e) 172 | exit(2) 173 | 174 | #设置请求头 175 | def setHeaders(cookie): 176 | headers = { 177 | 'Cookie': cookie, 178 | 'content-type': 'application/x-www-form-urlencoded', 179 | 'Connection': 'keep-alive', 180 | 'Accept-Encoding': 'gzip,compress,br,deflate', 181 | 'Referer': 'https://servicewechat.com/wxa5bf5ee667d91626/148/page-frame.html', 182 | 'Host': 'api.m.jd.com', 183 | 'User-Agent': 'Mozilla/5.0 (iPhone CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.7(0x1800072d) NetType/WIFI Language/zh_CN' 184 | } 185 | 186 | return headers 187 | 188 | def assist(ck, sid, eid, aid, user, name, a): 189 | timestamp = int(round(t * 1000)) 190 | headers = { 191 | 'Cookie': ck + 'wxclient=gxhwx;ie_ai=1;', 192 | 'Accept': '*/*', 193 | 'Connection': 'keep-alive', 194 | 'Referer': 'https://servicewechat.com/wxa5bf5ee667d91626/148/page-frame.html', 195 | 'Content-Type': 'application/x-www-form-urlencoded', 196 | 'Host': 'api.m.jd.com', 197 | 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.1(0x1800012a) NetType/WIFI Language/zh_CN', 198 | 'Accept-Encoding': 'gzip, deflate, br', 199 | 'Accept-Language': 'zh-cn' 200 | } 201 | url = 'https://api.m.jd.com/api?functionId=vvipclub_distributeBean_assist&body=%7B%22activityIdEncrypted%22:%22' + sid + '%5Cn%22,%22assistStartRecordId%22:%22' + str(aid) + '%22,%22assistedPinEncrypted%22:%22' + eid + '%5Cn%22,%22channel%22:%22FISSION_BEAN%22%7D&appid=swat_miniprogram&client=tjj_m&screen=1920*1080&osVersion=5.0.0&networkType=wifi&sdkName=orderDetail&sdkVersion=1.0.0&clientVersion=3.1.3&area=1_72_4137_0&fromType=wxapp×tamp=' + str(timestamp) 202 | resp = requests.get(url, headers=headers, verify=False, timeout=30).json() 203 | if resp['success']: 204 | print(f"用户{a}【{user}】助力【{name}】成功~") 205 | if resp['data']['assistedNum'] == 4: 206 | print("开启下一轮助力") 207 | starAssist(sid, header) 208 | getShareCode(header) 209 | else: 210 | print(f"用户{a}【{user}】助力【{name}】失败!!!") 211 | 212 | 213 | 214 | #开始互助 215 | def start(): 216 | global header 217 | print("微信小程序-赚京豆-瓜分助力") 218 | cookiesList, userNameList, pinNameList = iscookie() 219 | for ckNum in zlzh: 220 | print(f"### 开始助力账号【{userNameList[int(ckNum)-1]}】###") 221 | header = setHeaders(cookiesList[int(ckNum)-1]) 222 | getShareCode(header) 223 | starAssist(sid, header) 224 | getShareCode(header) 225 | a = 1 226 | for i, name in zip(cookiesList, userNameList): 227 | if a == ckNum: 228 | a += 1 229 | else: 230 | assist(i, sid, encPin, assistStartRecordId, name, userNameList[int(ckNum)-1], a) 231 | a += 1 232 | 233 | if __name__ == '__main__': 234 | start() 235 | -------------------------------------------------------------------------------- /jddjfruitcode.js: -------------------------------------------------------------------------------- 1 | //v6.3 2 | 3 | eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([4acdfhj-mo-qsu-wyzA-WYZ]|[1-3]\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('k 1A=\'\',c=\'\',2A=\'\',1r=\'\';k 1B=\'30.\'+q.v(q.1Y()*(2B-2b)+2b);k 1C=\'114.\'+q.v(q.1Y()*(2B-2b)+2b);k 1Z=q.v(q.1Y()*(1500-1i)+1i);k 1D=[],1s=\'\';1t=0,1N=0,1O=\'\',1R=\'\',2c=\'\';!(E()=>{f(1D.1u==0){f($.1v.1L){f(2D.1v.2E)2l=2D.1v.2E;delete 2m.cache[2l];k 2n=2m(2l);1E(1P 2F in 2n)1D.2G(2n[2F])}C{k 20=$.2d(\'#jddj_cookies\');f(!!20){f(20.2H(\',\')<0)1D.2G(20);C 1D=20.2e(\',\')}}}f(1D.1u==0){h.j(\'\\r\\n请先填写21\');1d}f(!$.1v.1L)23=$.2d(\'#jddj_isNotify\');C 1s=2m(\'./25\');1E(k i=0;i<1D.1u;i++){h.j(\'\\r\\n★★★★★开始执行第\'+(i+1)+\'个账号,共\'+1D.1u+\'个账号★★★★★\');1A=1D[i];f(!1A.trim())2I;1t=0,1N=0;c=2J();k s=2K(c,1A);u $.G.L(s).I(o=>{k 4=J.M(o.m);f(4.N==0){1A=\'2L=\'+c+\'; 2M=\'+4.l.2M+\'; 2o=\'+4.l.2o+\';\';2A=4.l.2o}C 1A=\'aabbcc\'});u 2N();u $.1l(1i);u 2p(0);u $.1l(1i);k 1e=u 2q();f(1e.N==1){$.1s(\'第\'+(i+1)+\'个账号21过期\',\'请访问D://A.B.z/1S/K.1S抓取21\',{1Q:\'D://A.B.z/1S/K.1S\'});f($.1v.1L&&\'\'+23+\'\'==\'H\'){u 1s.25(\'第\'+(i+1)+\'个账号21过期\',\'请访问D://A.B.z/1S/K.1S抓取21\')}2I}u 2O();u $.1l(1i);u 2P(1e);u $.1l(1i);u 2Q();u $.1l(1i);u 2R();u $.1l(1i);1R=\'\';1e=u 2q();1E(k K=0;K<1e.l.1M.1u;K++){k 26=1e.l.1M[K];f(26.1w==\'23eee1c043c01bc\'){1O+=\'@\'+26.uniqueId+\',\';h.j(\'\\n好友互助码:\'+1O);1R=\',助力\'+26.finishNum+\'/\'+26.totalNum;break}}u 2p(2);u $.1l(1i)}f((p w().getUTCHours()+8)%24<8){$.1s(\'京东到家果园互助码:\',\'\',1O);f($.1v.1L){1s.25(\'京东到家果园互助码:\',1O)}}f($.1v.1L)u 1s.25(\'京东到家果园信息\',2c);$.write(1O,\'2r\')})().1j(E(e)=>{h.j(\'\',\'❌失败! 原因:\'+e+\'!\',\'\');f($.1v.1L&&\'\'+23+\'\'==\'H\'){1s.25(\'京东到家果园\',\'❌失败! 原因:\'+e+\'!\')}}).2S(()=>{$.done()});E 1g 2N(){1d p 1x(E y=>{1k{k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&Q=H5&R=S&T=&U=8.7.6&jdDevice=&V=mine%2FgetUserAccountInfo&m=%7B%22refPageSource%22:%22%22,%22fromSource%22:2,%22pageSource%22:%2T%22,%22ref%22:%22%22,%22ctp%22:%2T%22%7D&jda=&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');$.G.L(s).I(o=>{k 4=J.M(o.m);f(4.N==0){1k{1r=4.l.userInfo.userBaseInfo.nickName;h.j("●●●"+1r+"●●●")}1j(F){1r=\'昵称获取失败\'}}});y()}1j(F){h.j(\'\\n【个人信息】:\'+F);y()}})}E 1g 2q(){1d p 1x(E y=>{1k{k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2Flist&19=H&m=%7B%1n%22%3A%2U%22%2C%1o%22%1p%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+\'&W=\'+c+\'&Y=\'+c,\'\');$.G.L(s).I(o=>{k 4=J.M(o.m);y(4)})}1j(F){h.j(\'\\n【任务列表】:\'+F);y({})}})}E 1g 2R(){1d p 1x(E y=>{1k{k s=O(\'D://A.B.z/P?17=\'+q.v(p w()),\'V=2f%2Fwatering&19=H&2V=2W&m=%7B%22waterTime%22%1p%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+\'&W=\'+c+\'&Y=\'+c);k 2s=1,2t=0;do{2t++;h.j(\'\\n**********开始执行第\'+2t+\'次浇水**********\');$.G.2X(s).I(o=>{k 4=J.M(o.m);h.j(\'\\n【浇水】:\'+4.d);2s=4.N;f(4.N==0)1N++});u $.1l(1i)}while(2s==0);y()}1j(F){h.j(\'\\n【浇水】:\'+F);y()}})}E 1g 2Y(){1d p 1x(E y=>{1k{k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=signin%2FuserSigninNew&19=H&m=%7B%22channel%22%3A%22daojiaguoyuan%22%2C%2Z%22%3A\'+1Z+\'%2C%31%22%3A\'+1C+\'%2C%32%22%3A\'+1B+\'%2C%22ifCic%22%3A0%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+\'&W=\'+c+\'&Y=\'+c,\'\');$.G.L(s).I(o=>{k 4=J.M(o.m);h.j(\'\\n【到家签到】:\'+4.d);y()})}1j(F){h.j(\'\\n【到家签到领水滴】:\'+F);y()}})}E 1g 2O(){1d p 1x(E y=>{1k{k 1T;k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=2f%2FgetWaterBottleInfo&19=H&m=%7B%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1U 4=J.M(o.m);f(4.N==0){1T=4.l.1T;h.j(\'\\n【收玻璃瓶水滴】:水瓶中有:\'+4.l.yesterdayAccumulate+\'水滴\')}C{h.j(\'\\n【收玻璃瓶水滴】:水瓶信息错误\')}});f(1T==0){s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=2f%2FreceiveWaterBottle&19=H&m=%7B%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{h.j(o.m);1U 4=J.M(o.m);f(4.N==0){h.j(\'\\n【收玻璃瓶水滴】:水瓶收取成功\')}C{h.j(\'\\n【收玻璃瓶水滴】:水瓶收取错误\')}})}C f(1T==1){h.j(\'\\n【收玻璃瓶水滴】:水瓶已经收取过\')}C f(1T==-2){h.j(\'\\n【收玻璃瓶水滴】:收取时间未到\')}C{h.j(\'\\n【收玻璃瓶水滴】:水瓶状态错误或暂不可收取:\')}y()}1j(F){h.j(\'\\n【收玻璃瓶水滴】:\'+F);y()}})}E 1g 2Q(){1d p 1x(E y=>{1k{k 2g=[],1q=\'\';u $.G.L({1Q:\'D://colakele.z/jdapi/code.js\'}).I(o=>{1q=o.m});1k{u $.G.L({1Q:\'G://51.15.187.136:8080/queryJddjCode\'}).I(o=>{1q+=o.m})}1j(F){}f($.2d(\'2r\'))1q+=$.2d(\'2r\');1q=1q.33(/ /g,\'\').33(/\\n/g,\'\');f(!!1q){1q=1q.substr(0,1q.1u-1);2g=1q.2e(\',\')}k 2u=2g[q.v(q.1Y()*(2g.1u-1)+0)];k s=O(\'D://A.B.z/P?1B=\'+1B+\'&1C=\'+1C+\'&34=\'+1B+\'&35=\'+1C+\'&36=\'+1Z+\'&W=\'+c+\'&Y=\'+c+\'&T=37&mpChannel=37&Z=5.0.0&Q=mini&U=5.0.0&R=S&11=12&xcxVersion=9.2.0&19=H&business=djgyzhuli&V=1m%2h&m=%7B%1n%22%3A%2U%22%2C%1y%22%3A1201%2C%1z%22%3A%2223eee1c043c01bc%22%2C%1o%22%3A5%2C%22assistTargetPin%22%3A%22\'+2u.2e(\'@\')[0]+\'%22%2C%22uniqueId%22%3A%22\'+2u.2e(\'@\')[1]+\'%22%7D\',\'\');$.G.L(s).I(o=>{k 4=J.M(o.m);h.j(\'\\n【助力】:\'+4.d);y()})}1j(F){h.j(\'\\n【助力】:\'+F);y()}})}E 1g _runTask(1e){1d p 1x(E y=>{1k{1E(k K=0;K<1e.l.1M.1u;K++){1U a=1e.l.1M[K];f(a.1h==38||a.1h==39){k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2v&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取任务【\'+a.1f+\'】:\'+d)})}f(a.1V>-1){1E(k t=0;t<2w(a.1V);t++){u $.1l(1i);h.j(\'计时:\'+(t+1)+\'秒...\')}};s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2h&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n任务完成【\'+a.1f+\'】:\'+d)});s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2x&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取奖励【\'+a.1f+\'】:\'+d)})}y()}1j(F){h.j(\'\\n【执行任务】:\'+F);y()}})}1U 3a=[38,39,3b,1105,1103,0,1101];E 1g 2P(1e){1d p 1x(E y=>{1k{1E(k K=0;K<1e.l.1M.1u;K++){1U a=1e.l.1M[K];f(a.1W==3||a.1W==2){h.j(\'\\n【\'+a.1f+\'】: 任务已完成,跳过做任务\')}C f(a.1h==502){u 2Y()}C f(3a.includes(a.1h)){f(a.1W==0){k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2v&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{k 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取任务【\'+a.1f+\'】:\'+d)});f(a.1V>-1){1E(k t=0;t<2w(a.1V);t++){u $.1l(1i);h.j(\'计时:\'+(t+1)+\'秒...\')}}}C{h.j(\'\\n【\'+a.1f+\'】: 任务已领取或不需要领取\')};f(a.1h!=0){s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2h&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{k 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J;a.1W=2}C{d=4.d}h.j(\'\\n任务完成【\'+a.1f+\'】:\'+d)})}}C{h.j(\'\\n【\'+a.1f+\'】: 脚本无法执行此任务或任务不需要主动完成\')}f(a.1W==2||a.taskTypes==3b){s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2x&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{k 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取奖励【\'+a.1f+\'】:\'+d)})}C f(a.1W==3){h.j(\'\\n【\'+a.1f+\'】: 奖励已领取,跳过领奖励\')}C{h.j(\'\\n【\'+a.1f+\'】: 任务未完成,跳过领奖励\')}}y()}1j(F){h.j(\'\\n【执行任务】:\'+F);y()}})}E 1g runTask2(1e){1d p 1x(E y=>{1k{1E(k K=0;K<1e.l.1M.1u;K++){1U a=1e.l.1M[K];f(a.1f.2H(\'限时\')>-1){k s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2v&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取任务【\'+a.1f+\'】:\'+d)});f(a.1V>-1){1E(k t=0;t<2w(a.1V);t++){u $.1l(1i);h.j(\'计时:\'+(t+1)+\'秒...\')}};s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2h&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n任务完成【\'+a.1f+\'】:\'+d)});s=O(\'D://A.B.z/P?17=\'+q.v(p w())+\'&V=1m%2x&19=H&m=%7B%1n%22%3A%22\'+a.1F+\'%22%2C%1z%22%3A%22\'+1G(a.1w)+\'%22%2C%1y%22%3A\'+a.1h+\'%2C%1o%22%1p%2C%1H%22%1I%7D&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c,\'\');u $.G.L(s).I(o=>{1P 4=J.M(o.m),d=\'\';f(4.N==0){d=4.d+\',奖励:\'+4.l.1J}C{d=4.d}h.j(\'\\n领取奖励【\'+a.1f+\'】:\'+d)})}}y()}1j(F){h.j(\'\\n【执行任务】:\'+F);y()}})}E 1g 2p(2y){1d p 1x(E y=>{1k{k s=O(\'D://A.B.z:443/P?17=\'+q.v(p w()),\'V=2f%2FinitFruit&19=H&2V=2W&m=%7B%2Z%22%3A\'+1Z+\'%2C%31%22%3A\'+1C+\'%2C%32%22%3A\'+1B+\'%7D&1B=\'+1B+\'&1C=\'+1C+\'&34=\'+1B+\'&35=\'+1C+\'&36=\'+1Z+\'&T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&18=\'+c+q.v(p w())+\'&W=\'+c+\'&Y=\'+c);u $.G.2X(s).I(E o=>{k 4=J.M(o.m);f(4.N==0){f(2y==0){1t=4.l.27.28;1O+=4.l.1c.userPin}f(2y==2){1t=(1N*10)+4.l.27.28-1t;f(1t<0)1t=0;f(4.l.1c.29==0){h.j(\'\\n京东到家果园【\'+1r+\'】:\'+4.l.1c.1X+\'已成熟,快去收取!\');$.1s(\'京东到家果园\',\'【\'+1r+\'】\',\'京东到家果园\'+4.l.1c.1X+\'已成熟,快去收取!\');f($.1v.1L&&\'\'+23+\'\'==\'H\'){2c+=\'\\r\\n【\'+1r+\'】\\r\\n京东到家果园\'+4.l.1c.1X+\'已成熟,快去收取!\'}}f(4.l.1c.29>0){k 2a=\'次\';f(4.l.1c.growingStage==5)2a=\'%\';h.j(\'\\n京东到家果园【\'+1r+\'】:\'+4.l.1c.1X+\',本次领取\'+1t+\'滴水,浇水\'+1N+\'次,还需浇水\'+4.l.1c.29+2a+4.l.1c.2z+\',还剩\'+4.l.27.28+\'滴水\'+1R);$.1s(\'京东到家果园\',\'【\'+1r+\'】\',\'【果树信息】:\'+4.l.1c.1X+\',本次领取\'+1t+\'滴水,浇水\'+1N+\'次,还需浇水\'+4.l.1c.29+2a+4.l.1c.2z+\',还剩\'+4.l.27.28+\'滴水\'+1R);f($.1v.1L&&\'\'+23+\'\'==\'H\'){2c+=\'\\r\\n【\'+1r+\'】\\r\\n【果树信息】:\'+4.l.1c.1X+\',本次领取\'+1t+\'滴水,浇水\'+1N+\'次,还需浇水\'+4.l.1c.29+2a+4.l.1c.2z+\',还剩\'+4.l.27.28+\'滴水\'+1R}}}}y()})}1j(F){h.j(\'\\n【果树信息】:\'+F);y()}2S{treeInfoTimes=H}})}1g O(1Q,m){k s={1Q:1Q,3c:{\'3d\':\'A.B.z\',\'3e-3f\':\'3g/x-3h-3i-3j;\',\'Origin\':\'D://A.B.z\',\'3k\':1A,\'Connection\':\'keep-alive\',\'3l\':\'*/*\',\'3m-3n\':\'3o/5.0 (2i; 3p 2i OS 14_1 2k 3q OS X) 3r/3s.1.15 (3t, 2k 3u) Mobile/15E148________appName=jdLocal&Z=iOS&commonParams={"sharePackageVersion":"2"}&djAppVersion=8.7.5&supportDJSHWK\',\'3l-Language\':\'zh-cn\'},m:m};1d s}1g 2K(c,1A){1d{1Q:\'D://A.B.z/P?_jdRandom=\'+(+p w())+\'&V=xapp/loginByPtKeyNew&m=\'+escape(J.stringify({"fromSource":5,"businessChannel":150,"subChannel":"","regChannel":""}))+\'T=1a&Z=6.6.0&Q=h5&U=6.6.0&R=S&11=12&N=011UYn000apwmL1nWB000aGiv74UYn03&Y=\'+c+\'&W=\'+c+\'&11=12\',3c:{"3k":\'2L=\'+c+\';\'+1A+\';\',"3d":"A.B.z","referer":"D://A.B.z/taroh5/h5dist/",\'3e-3f\':\'3g/x-3h-3i-3j\',"3m-3n":\'3o/5.0 (2i; 3p 2i OS 14_4_1 2k 3q OS X) 3r/3s.1.15 (3t, 2k 3u)\'}}}1g 2J(){1g s4(){1d q.floor((1+q.1Y())*0x10000).toString(16).substring(1)}1d s4()+s4()+\'-\'+s4()+\'-\'+s4()+\'-\'+s4()+\'-\'+s4()+s4()+s4()}',[],217,'||||data||||||item||deviceid|msg||if||console||log|let|result|body||response|new|Math||option||await|round|Date||resolve|com|daojia|jd|else|https|async|error|http|true|then|JSON|index|get|parse|code|urlTask|client|platCode|appName|paidaojia|channel|appVersion|functionId|deviceToken||deviceId|platform||deviceModel|appmodel|||||_jdrandom|traceId|isNeedDealError|ios||activityInfoResponse|return|tslist|taskTitle|function|taskType|1000|catch|try|wait|task|22modelId|22plateCode|3A1|codestr|nickname|notify|waterNum|length|env|taskId|Promise|22taskType|22taskId|thiscookie|lat|lng|cookies|for|modelId|encodeURIComponent|22subNode|3Anull|awardValue||isNode|taskInfoList|waterTimes|shareCode|var|url|hzstr|html|receiveStatus|const|browseTime|status|fruitName|random|cityid|ckstr|cookie||isNotify||sendNotify|element|userResponse|waterBalance|curStageLeftProcess|unit|10000|msgStr|read|split|fruit|scodes|2Ffinished|iPhone||like|ckPath|require|jdcookies|o2o_m_h5_sid|treeInfo|taskList|shareCodes|waterStatus|waterCount|scode|2Freceived|parseInt|2FsendPrize|step|stageName|sid|99999||process|JDDJ_CKPATH|key|push|indexOf|continue|_uuid|taskLoginUrl|deviceid_pdj_jd|PDJ_H5_PIN|userinfo|waterBottle|runTask|zhuLi|water|finally|22myinfo|22M10007|method|POST|post|sign|22cityId||22longitude|22latitude|replace|lat_pos|lng_pos|city_id|wx_xcx|307|901|do_tasks|1102|headers|Host|Content|Type|application|www|form|urlencoded|Cookie|Accept|User|Agent|Mozilla|CPU|Mac|AppleWebKit|605|KHTML|Gecko'.split('|'),0,{})) 4 | -------------------------------------------------------------------------------- /jx_cfdtx.js: -------------------------------------------------------------------------------- 1 | 2 | [task_local] 3 | #京喜财富岛提现 4 | 0 0 0 * * ? * https://raw.githubusercontent.com/colakele/jd/master/jx_cfdtx.js, tag=京喜财富岛提现, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_syj.png, enabled=true 5 | 6 | const $ = new Env("京喜财富岛提现"); 7 | const JD_API_HOST = "https://m.jingxi.com/"; 8 | const jdCookieNode = $.isNode() ? require("./jdCookie.js") : ""; 9 | const jdTokenNode = $.isNode() ? require('./jdJxncTokens.js') : ''; 10 | $.result = []; 11 | $.cookieArr = []; 12 | $.currentCookie = ''; 13 | $.tokenArr = []; 14 | $.currentToken = {}; 15 | $.strPhoneID = ''; 16 | $.strPgUUNum = ''; 17 | $.userName = ''; 18 | 19 | !(async () => { 20 | if (!getCookies()) return; 21 | if (!getTokens()) return; 22 | for (let i = 0; i < $.cookieArr.length; i++) { 23 | $.currentCookie = $.cookieArr[i]; 24 | $.currentToken = $.tokenArr[i]; 25 | if ($.currentCookie) { 26 | $.userName = decodeURIComponent($.currentCookie.match(/pt_pin=(.+?);/) && $.currentCookie.match(/pt_pin=(.+?);/)[1]); 27 | $.log(`\n开始【京东账号${i + 1}】${$.userName}`); 28 | 29 | await cashOut(); 30 | } 31 | } 32 | await showMsg(); 33 | })() 34 | .catch((e) => $.logErr(e)) 35 | .finally(() => $.done()); 36 | 37 | function cashOut() { 38 | return new Promise(async (resolve) => { 39 | $.get( 40 | taskUrl( 41 | `consume/CashOut`, 42 | `ddwMoney=100&dwIsCreateToken=0&ddwMinPaperMoney=150000&strPgtimestamp=${$.currentToken['timestamp']}&strPhoneID=${$.currentToken['phoneid']}&strPgUUNum=${$.currentToken['farm_jstoken']}` 43 | ), 44 | async (err, resp, data) => { 45 | try { 46 | $.log(data); 47 | const { iRet, sErrMsg } = JSON.parse(data); 48 | $.log(sErrMsg); 49 | $.result.push(`【${$.userName}】\n ${sErrMsg == "" ? sErrMsg="今天手气太棒了" : sErrMsg}`); 50 | resolve(sErrMsg); 51 | } catch (e) { 52 | $.logErr(e, resp); 53 | } finally { 54 | resolve(); 55 | } 56 | } 57 | ); 58 | }); 59 | } 60 | 61 | function taskUrl(function_path, body) { 62 | return { 63 | url: `${JD_API_HOST}jxcfd/${function_path}?strZone=jxcfd&bizCode=jxcfd&source=jxcfd&dwEnv=7&_cfd_t=${Date.now()}&ptag=&${body}&_stk=_cfd_t%2CbizCode%2CddwMinPaperMoney%2CddwMoney%2CdwEnv%2CdwIsCreateToken%2Cptag%2Csource%2CstrPgUUNum%2CstrPgtimestamp%2CstrPhoneID%2CstrZone&_ste=1&_=${Date.now()}&sceneval=2&g_login_type=1&g_ty=ls`, 64 | headers: { 65 | Cookie: $.currentCookie, 66 | Accept: "*/*", 67 | Connection: "keep-alive", 68 | Referer:"https://st.jingxi.com/fortune_island/cash.html?jxsid=16115391812299482601&_f_i_jxapp=1", 69 | "Accept-Encoding": "gzip, deflate, br", 70 | Host: "m.jingxi.com", 71 | "User-Agent":"jdpingou;iPhone;4.1.4;14.3;9f08e3faf2c0b4e72900552400dfad2e7b2273ba;network/wifi;model/iPhone11,6;appBuild/100415;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/428;pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148", 72 | "Accept-Language": "zh-cn", 73 | }, 74 | }; 75 | } 76 | 77 | function getCookies() { 78 | if ($.isNode()) { 79 | $.cookieArr = Object.values(jdCookieNode); 80 | } else { 81 | const CookiesJd = JSON.parse($.getdata("CookiesJD") || "[]").filter(x => !!x).map(x => x.cookie); 82 | $.cookieArr = [$.getdata("CookieJD") || "", $.getdata("CookieJD2") || "", ...CookiesJd]; 83 | } 84 | if (!$.cookieArr[0]) { 85 | $.msg( 86 | $.name, 87 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", 88 | "https://bean.m.jd.com/", 89 | { 90 | "open-url": "https://bean.m.jd.com/", 91 | } 92 | ); 93 | return false; 94 | } 95 | return true; 96 | } 97 | 98 | function getTokens() { 99 | if ($.isNode()) { 100 | Object.keys(jdTokenNode).forEach((item) => { 101 | $.tokenArr.push(jdTokenNode[item] ? JSON.parse(jdTokenNode[item]) : '{}'); 102 | }) 103 | } else { 104 | $.tokenArr = JSON.parse($.getdata('jx_tokens') || '[]'); 105 | } 106 | if (!$.tokenArr[0]) { 107 | $.msg( 108 | $.name, 109 | "【⏰提示】请先获取京喜Token\n获取方式见脚本说明" 110 | ); 111 | return false; 112 | } 113 | return true; 114 | } 115 | 116 | function showMsg() { 117 | return new Promise((resolve) => { 118 | if ($.notifyTime) { 119 | const notifyTimes = $.notifyTime.split(",").map((x) => x.split(":")); 120 | const now = $.time("HH:mm").split(":"); 121 | $.log(`\n${JSON.stringify(notifyTimes)}`); 122 | $.log(`\n${JSON.stringify(now)}`); 123 | if ( 124 | notifyTimes.some((x) => x[0] === now[0] && (!x[1] || x[1] === now[1])) 125 | ) { 126 | $.msg($.name, "", `\n${$.result.join("\n")}`); 127 | } 128 | } else { 129 | $.msg($.name, "", `\n${$.result.join("\n")}`); 130 | } 131 | resolve(); 132 | }); 133 | } 134 | 135 | // prettier-ignore 136 | 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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),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){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 137 | -------------------------------------------------------------------------------- /list.txt: -------------------------------------------------------------------------------- 1 | jd_crazyJoy.js 京东疯狂的Joy 2 | jd_deleteCoupon.js 京东删除优惠券 3 | jd_jxmc.js 京喜牧场 4 | jd_kanjia.js 柠檬0元砍价 5 | jd_lotteryMachine.js 京东抽奖机 6 | jd_pk.js 京享值PK 7 | jd_ppdz.js 柠檬东东泡泡大战 8 | jd_priceProtect.js 价格保护 9 | jd_rankingList.js 京东排行榜 10 | jd_SplitRedPacket.js 天降红包 11 | jd_sqdyj.js 省钱大赢家 12 | jd_half_redrain.js 半点红包雨 13 | jd_hby_lottery.js 主会场红包雨 14 | sendNotify.js 15 | jd_zooJointeam01.js 纯开卡 GNC组队瓜分京豆 16 | jd_Jx88hongbao.js 京喜 领88元红包 17 | jd_zooSupershophf.js 合肥旗舰店开业 18 | jd_yqyl.js 邀请有礼 19 | jd_bean_change.js 京东资产变动通知 20 | jd_bean_home.js领京豆额外奖励 21 | jd_bean_sign.js 京东多合一签到 22 | jd_beauty.js 美丽研究院 23 | jd_blueCoin.js 东东超市兑换奖品 24 | jd_bookshop.js 口袋书店 invite 25 | jd_car.js 京东汽车 26 | jd_cash.js 签到领现金 27 | jd_cfd.js 京喜财富岛 28 | jd_club_lottery.js 摇京豆 29 | jd_crazy_joy_bonus.js 监控crazyJoy分红 30 | jd_crazy_joy_coin.js crazy joy挂机领金币 31 | jd_daily_lottery.js 京东金融-天天提鹅 32 | jd_daily_lottery.js 小鸽有礼-每日抽奖 33 | jd_dreamFactory.js 京东京喜工厂 34 | JD_extra_cookie.js 35 | jd_family.js 京东家庭号 36 | jd_fruit.js 东东水果 37 | jd_get_share_code.js 互助码 38 | jd_gold_creator.js 金榜创造营 39 | jd_health.js 东东健康社区 40 | jd_health_collect.js 东东健康社区收集能量收集能量 41 | jd_jdfactory.js 东东工厂 42 | jd_jdzz.js 京东赚赚 43 | jd_jin_tie.js 领金贴 44 | jd_joy.js jd宠汪汪 45 | jd_joy_feedPets.js 宠汪汪喂食 46 | jd_joy_reward.js 宠汪汪积分兑换奖品 47 | jd_joy_run.js宠汪汪邀请助力与赛跑助力脚本 48 | jd_joy_steal.js宠汪汪偷好友积分与狗粮 49 | jd_jxnc.js 京喜农场 50 | jd_kd.js 京东快递签到 51 | jd_live.js 京东直播 52 | jd_market_lottery.js 幸运大转盘 53 | jd_mohe.js 5G超级盲盒 54 | jd_moneyTree.js 京东摇钱树 55 | jd_ms.js京东秒秒币 56 | jd_necklace.js 点点券 57 | jd_pet.js 东东萌宠 58 | jd_pigPet.js 金融养猪 59 | jd_plantBean.js 种豆得豆 60 | jd_redPacket.js 全民开红包 61 | jd_sgmh.js 闪购盲盒 62 | jd_shop.js 进店领豆 63 | jd_speed.js 天天加速 64 | jd_speed_redpocke.js 极速版红包 65 | jd_speed_sign.js 京东极速版签到+赚现金任务 66 | jd_superMarket.js 东东超市 67 | jd_syj.js 赚京豆脚本 68 | jd_unsubscribe.js 取关京东店铺和商品 69 | jdDreamFactoryShareCodes.js 京喜工厂互助码 70 | jdFactoryShareCodes.js 东东工厂互助码 71 | jdFruitShareCodes.js 东东农场互助码 72 | jdJxncShareCodes.js 京喜农场助力码 73 | jdPetShareCodes.js 东东萌宠互助码 74 | jdPlantBeanShareCodes.js 京东种豆得豆互助码 75 | JS_USER_AGENTS.js 用户代理 76 | USER_AGENTS.js 用户代理 77 | jd_try.js 京东试用 78 | -------------------------------------------------------------------------------- /png-js.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | let util = require("util"); 4 | let Stream = require("stream"); 5 | let Parser = require("./parser-async"); 6 | let Packer = require("./packer-async"); 7 | let PNGSync = require("./png-sync"); 8 | 9 | let PNG = (exports.PNG = function (options) { 10 | Stream.call(this); 11 | 12 | options = options || {}; // eslint-disable-line no-param-reassign 13 | 14 | // coerce pixel dimensions to integers (also coerces undefined -> 0): 15 | this.width = options.width | 0; 16 | this.height = options.height | 0; 17 | 18 | this.data = 19 | this.width > 0 && this.height > 0 20 | ? Buffer.alloc(4 * this.width * this.height) 21 | : null; 22 | 23 | if (options.fill && this.data) { 24 | this.data.fill(0); 25 | } 26 | 27 | this.gamma = 0; 28 | this.readable = this.writable = true; 29 | 30 | this._parser = new Parser(options); 31 | 32 | this._parser.on("error", this.emit.bind(this, "error")); 33 | this._parser.on("close", this._handleClose.bind(this)); 34 | this._parser.on("metadata", this._metadata.bind(this)); 35 | this._parser.on("gamma", this._gamma.bind(this)); 36 | this._parser.on( 37 | "parsed", 38 | function (data) { 39 | this.data = data; 40 | this.emit("parsed", data); 41 | }.bind(this) 42 | ); 43 | 44 | this._packer = new Packer(options); 45 | this._packer.on("data", this.emit.bind(this, "data")); 46 | this._packer.on("end", this.emit.bind(this, "end")); 47 | this._parser.on("close", this._handleClose.bind(this)); 48 | this._packer.on("error", this.emit.bind(this, "error")); 49 | }); 50 | util.inherits(PNG, Stream); 51 | 52 | PNG.sync = PNGSync; 53 | 54 | PNG.prototype.pack = function () { 55 | if (!this.data || !this.data.length) { 56 | this.emit("error", "No data provided"); 57 | return this; 58 | } 59 | 60 | process.nextTick( 61 | function () { 62 | this._packer.pack(this.data, this.width, this.height, this.gamma); 63 | }.bind(this) 64 | ); 65 | 66 | return this; 67 | }; 68 | 69 | PNG.prototype.parse = function (data, callback) { 70 | if (callback) { 71 | let onParsed, onError; 72 | 73 | onParsed = function (parsedData) { 74 | this.removeListener("error", onError); 75 | 76 | this.data = parsedData; 77 | callback(null, this); 78 | }.bind(this); 79 | 80 | onError = function (err) { 81 | this.removeListener("parsed", onParsed); 82 | 83 | callback(err, null); 84 | }.bind(this); 85 | 86 | this.once("parsed", onParsed); 87 | this.once("error", onError); 88 | } 89 | 90 | this.end(data); 91 | return this; 92 | }; 93 | 94 | PNG.prototype.write = function (data) { 95 | this._parser.write(data); 96 | return true; 97 | }; 98 | 99 | PNG.prototype.end = function (data) { 100 | this._parser.end(data); 101 | }; 102 | 103 | PNG.prototype._metadata = function (metadata) { 104 | this.width = metadata.width; 105 | this.height = metadata.height; 106 | 107 | this.emit("metadata", metadata); 108 | }; 109 | 110 | PNG.prototype._gamma = function (gamma) { 111 | this.gamma = gamma; 112 | }; 113 | 114 | PNG.prototype._handleClose = function () { 115 | if (!this._parser.writable && !this._packer.readable) { 116 | this.emit("close"); 117 | } 118 | }; 119 | 120 | PNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) { 121 | // eslint-disable-line max-params 122 | // coerce pixel dimensions to integers (also coerces undefined -> 0): 123 | /* eslint-disable no-param-reassign */ 124 | srcX |= 0; 125 | srcY |= 0; 126 | width |= 0; 127 | height |= 0; 128 | deltaX |= 0; 129 | deltaY |= 0; 130 | /* eslint-enable no-param-reassign */ 131 | 132 | if ( 133 | srcX > src.width || 134 | srcY > src.height || 135 | srcX + width > src.width || 136 | srcY + height > src.height 137 | ) { 138 | throw new Error("bitblt reading outside image"); 139 | } 140 | 141 | if ( 142 | deltaX > dst.width || 143 | deltaY > dst.height || 144 | deltaX + width > dst.width || 145 | deltaY + height > dst.height 146 | ) { 147 | throw new Error("bitblt writing outside image"); 148 | } 149 | 150 | for (let y = 0; y < height; y++) { 151 | src.data.copy( 152 | dst.data, 153 | ((deltaY + y) * dst.width + deltaX) << 2, 154 | ((srcY + y) * src.width + srcX) << 2, 155 | ((srcY + y) * src.width + srcX + width) << 2 156 | ); 157 | } 158 | }; 159 | 160 | PNG.prototype.bitblt = function ( 161 | dst, 162 | srcX, 163 | srcY, 164 | width, 165 | height, 166 | deltaX, 167 | deltaY 168 | ) { 169 | // eslint-disable-line max-params 170 | 171 | PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); 172 | return this; 173 | }; 174 | 175 | PNG.adjustGamma = function (src) { 176 | if (src.gamma) { 177 | for (let y = 0; y < src.height; y++) { 178 | for (let x = 0; x < src.width; x++) { 179 | let idx = (src.width * y + x) << 2; 180 | 181 | for (let i = 0; i < 3; i++) { 182 | let sample = src.data[idx + i] / 255; 183 | sample = Math.pow(sample, 1 / 2.2 / src.gamma); 184 | src.data[idx + i] = Math.round(sample * 255); 185 | } 186 | } 187 | } 188 | src.gamma = 0; 189 | } 190 | }; 191 | 192 | PNG.prototype.adjustGamma = function () { 193 | PNG.adjustGamma(this); 194 | }; 195 | -------------------------------------------------------------------------------- /sqyqm.js: -------------------------------------------------------------------------------- 1 | /* 2 | #柠檬省钱大赢家 3 | #自定义邀请码环境变量 4 | export redEnvelopeId="" ##本期活动ID 5 | export inviter="" ##邀请码 6 | [task_local] 7 | #柠檬省钱大赢家 8 | 0,2 0 * * * http://nm66.top/jd_sqdyj.js, tag=柠檬省钱大赢家, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true 9 | */ 10 | 11 | 12 | const $ = new Env('柠檬省钱大赢家获取邀请码'); 13 | const notify = $.isNode() ? require('./sendNotify') : ''; 14 | //Node.js用户请在jdCookie.js处填写京东ck; 15 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; 16 | 17 | //IOS等用户直接用NobyDa的jd cookie 18 | let cookiesArr = [], cookie = '', message; 19 | let redEnvelopeId = ''; 20 | let inviter = ''; 21 | 22 | if (process.env.redEnvelopeId) { 23 | redEnvelopeId = process.env.redEnvelopeId; 24 | } 25 | 26 | if (process.env.inviter) { 27 | inviter = process.env.inviter; 28 | } 29 | if ($.isNode()) { 30 | Object.keys(jdCookieNode).forEach((item) => { 31 | cookiesArr.push(jdCookieNode[item]) 32 | }) 33 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; 34 | } else { 35 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); 36 | } 37 | const JD_API_HOST = 'https://api.m.jd.com/client.action'; 38 | 39 | !(async () => { 40 | if (!cookiesArr[0]) { 41 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 42 | return; 43 | } 44 | 45 | for (let i = 0; i < cookiesArr.length; i++) { 46 | if (cookiesArr[i]) { 47 | cookie = cookiesArr[i]; 48 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 49 | $.index = i + 1; 50 | $.isLogin = true; 51 | $.nickName = ''; 52 | message = ''; 53 | await TotalBean(); 54 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); 55 | if (!$.isLogin) { 56 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 57 | 58 | if ($.isNode()) { 59 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 60 | } 61 | continue 62 | } 63 | //await zhuli() 64 | // await list() 65 | await info() 66 | 67 | 68 | 69 | } 70 | } 71 | })() 72 | .catch((e) => { 73 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') 74 | }) 75 | .finally(() => { 76 | $.done(); 77 | }) 78 | function info() { 79 | return new Promise(async (resolve) => { 80 | 81 | let options = { 82 | url: `https://api.m.jd.com/?functionId=redEnvelopeInteractHome&body={%22linkId%22:%22DA4SkG7NXupA9sksI00L0g%22,%22redEnvelopeId%22:%22%22,%22inviter%22:%22%22,%22helpType%22:%22%22}&t=1623125906167&appid=activities_platform&clientVersion=3.3.6`, 83 | 84 | //body: `{"activeId":"A_112790_R_1_D_20201028","refid":"wojing","lkEPin":"${pink}","token":"AAFguxKvADBobq66W4IJvXqvty5l_OLH9MzDgGudMbfKCqDOfRznQ7agP8JaBeMo06pYCflk8I4","source":"wojing","scene":"3"}`, 85 | headers: { 86 | "Origin": "https://618redpacket.jd.com", 87 | "Host": "api.m.jd.com", 88 | "User-Agent": "jdltapp;iPhone;3.3.6;14.3;75aeceef3046d8ce11d354ff89af9517a2e4aa18;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,2;addressid/;hasOCPay/0;appBuild/1060;supportBestPay/0;pv/56.42;apprpd/;ref/JDLTSubMainPageViewController;psq/38;ads/;psn/75aeceef3046d8ce11d354ff89af9517a2e4aa18|99;jdv/0|kong|t_1001003207_1762319_6901310|jingfen|30578707801140d09fcd54e5cd83bbf7|1621510932517|1621511027;adk/;app_device/IOS;pap/JA2020_3112531|3.3.6|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 89 | "Cookie": cookie, 90 | } 91 | } 92 | 93 | $.get(options, async (err, resp, data) => { 94 | try { 95 | 96 | data = JSON.parse(data); 97 | 98 | 99 | 100 | if(data.code == 0){ 101 | console.log(`{"ningmengsq": {"redEnvelopeId":"${data.data.redEnvelopeId}","inviter":"${data.data.markedPin}"}}`) 102 | //console.log('你的活动ID:'+data.data.redEnvelopeId+'\n你的邀请码:'+data.data.markedPin) 103 | 104 | } 105 | } catch (e) { 106 | $.logErr(e, resp); 107 | } finally { 108 | resolve(); 109 | } 110 | }); 111 | }); 112 | } 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | async function taskPostUrl(functionId,body) { 134 | return { 135 | url: `${JD_API_HOST}`, 136 | body: `functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&appid=content_ecology&uuid=6898c30638c55142969304c8e2167997fa59eb54&t=1622588448365`, 137 | headers: { 138 | 'Cookie': cookie, 139 | 'Host': 'api.m.jd.com', 140 | 'Connection': 'keep-alive', 141 | 'Content-Type': 'application/x-www-form-urlencoded', 142 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), 143 | 'Accept-Language': 'zh-cn', 144 | 'Accept-Encoding': 'gzip, deflate, br', 145 | } 146 | } 147 | } 148 | 149 | 150 | async function TotalBean() { 151 | return new Promise(async resolve => { 152 | const options = { 153 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, 154 | "headers": { 155 | "Accept": "application/json,text/plain, */*", 156 | "Content-Type": "application/x-www-form-urlencoded", 157 | "Accept-Encoding": "gzip, deflate, br", 158 | "Accept-Language": "zh-cn", 159 | "Connection": "keep-alive", 160 | "Cookie": cookie, 161 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", 162 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 163 | } 164 | } 165 | $.post(options, (err, resp, data) => { 166 | try { 167 | if (err) { 168 | console.log(`${JSON.stringify(err)}`) 169 | console.log(`${$.name} API请求失败,请检查网路重试`) 170 | } else { 171 | if (data) { 172 | data = JSON.parse(data); 173 | if (data["retcode"] === 13) { 174 | $.isLogin = false; //cookie过期 175 | return; 176 | } 177 | if (data["retcode"] === 0) { 178 | $.nickName = (data["base"] && data["base"].nickname) || $.UserName; 179 | } else { 180 | $.nickName = $.UserName; 181 | } 182 | } else { 183 | console.log(`京东服务器返回空数据`) 184 | } 185 | } 186 | } catch (e) { 187 | $.logErr(e, resp) 188 | } finally { 189 | resolve(); 190 | } 191 | }) 192 | }) 193 | } 194 | async function safeGet(data) { 195 | try { 196 | if (typeof JSON.parse(data) == "object") { 197 | return true; 198 | } 199 | } catch (e) { 200 | console.log(e); 201 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 202 | return false; 203 | } 204 | } 205 | function jsonParse(str) { 206 | if (typeof str == "string") { 207 | try { 208 | return JSON.parse(str); 209 | } catch (e) { 210 | console.log(e); 211 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 212 | return []; 213 | } 214 | } 215 | } 216 | // prettier-ignore 217 | 218 | function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);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,i)=>{s.call(this,t,(t,s,r)=>{t?i(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.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}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 i=this.getdata(t);if(i)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 r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};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),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)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,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),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):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=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(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),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(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:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}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}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!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)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 219 | --------------------------------------------------------------------------------