(fn)
| 436 | } |
| 437 | |
| 438 | function 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 | |
| 459 | let cookiesArr = [], cookie = '', notify; |
| 460 | $.get = injectToRequest($.get.bind($)) |
no test coverage detected