MCPcopy Create free account
hub / github.com/Semporia/Scripts / getJoy

Function getJoy

jd_get_share_code.js:492–535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

490 await jdFruit();
491}
492async function getJoy(){
493 function taskUrl(functionId, body = '') {
494 let t = Date.now().toString().substr(0, 10)
495 let e = body || ""
496 e = $.md5("aDvScBv$gGQvrXfva8dG!ZC@DA70Y%lX" + e + t)
497 e = e + Number(t).toString(16)
498 return {
499 url: `${JD_API_HOST}?uts=${e}&appid=crazy_joy&functionId=${functionId}&body=${escape(body)}&t=${t}`,
500 headers: {
501 'Cookie': cookie,
502 'Host': 'api.m.jd.com',
503 'Accept': '*/*',
504 'Connection': 'keep-alive',
505 "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"),
506 'Accept-Language': 'zh-cn',
507 'Referer': 'https://crazy-joy.jd.com/',
508 'origin': 'https://crazy-joy.jd.com',
509 'Accept-Encoding': 'gzip, deflate, br',
510 }
511 }
512 }
513 let body = {"paramData": {}}
514 return new Promise(async resolve => {
515 $.get(taskUrl('crazyJoy_user_gameState', JSON.stringify(body)), async (err, resp, data) => {
516 try {
517 if (err) {
518 console.log(`${JSON.stringify(err)}`)
519 console.log(`${$.name} API请求失败,请检查网路重试`)
520 } else {
521 if (safeGet(data)) {
522 data = JSON.parse(data);
523 if (data.success && data.data && data.data.userInviteCode) {
524 console.log(`【京东账号${$.index}(${$.UserName})crazyJoy】${data.data.userInviteCode}`)
525 }
526 }
527 }
528 } catch (e) {
529 $.logErr(e, resp)
530 } finally {
531 resolve();
532 }
533 })
534 })
535}
536//闪购盲盒
537async function getSgmh(timeout = 0) {
538 return new Promise((resolve) => {

Callers 1

getShareCodeFunction · 0.85

Calls 5

taskUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected