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

Function injectToRequest

jd_joy_new.js:438–457  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

436}
437
438function injectToRequest(fn) {
439 return (opts, cb) => {
440 fn(opts, async (err, resp, data) => {
441 if (err) {
442 console.error('Failed to request.');
443 return;
444 }
445
446 if (data.search('验证') > -1) {
447 console.log('JDJRValidator trying......');
448 const res = await new JDJRValidator().run();
449
450 opts.url += `&validate=${res.validate}`;
451 fn(opts, cb);
452 } else {
453 cb(err, resp, data);
454 }
455 });
456 };
457}
458
459let cookiesArr = [], cookie = '', notify;
460$.get = injectToRequest($.get.bind($))

Callers 1

jd_joy_new.jsFile · 0.70

Calls 3

errorMethod · 0.80
logMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected