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

Function getTask

jd_shop.js:134–162  ·  view source on GitHub ↗
(body = {})

Source from the content-addressed store, hash-verified

132 })
133}
134function getTask(body = {}) {
135 return new Promise(resolve => {
136 const options = {
137 url: `${JD_API_HOST}`,
138 body: `functionId=queryTaskIndex&body=${escape(JSON.stringify(body))}&appid=ld`,
139 headers: {
140 '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"),
141 'Host': 'api.m.jd.com',
142 'Content-Type': 'application/x-www-form-urlencoded',
143 'Cookie': cookie,
144 }
145 }
146 $.post(options, (err, resp, data) => {
147 try {
148 if (err) {
149 console.log('\n进店领豆: API查询请求失败 ‼️‼️')
150 $.logErr(err);
151 } else {
152 // console.log(data)
153 data = JSON.parse(data);
154 }
155 } catch (e) {
156 $.logErr(e, resp);
157 } finally {
158 resolve(data);
159 }
160 })
161 })
162}
163function TotalBean() {
164 return new Promise(async resolve => {
165 const options = {

Callers 1

jdShopFunction · 0.70

Calls 5

isNodeMethod · 0.45
getdataMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected