我尝试使用 nba.com api,但出现错误。
“RequestError:错误:在 Request.plumbing.callback (c:\ Users\Omer\Desktop\game\node_modules\request-promise-core\lib\plumbing.js:87:29) 在 Request.RP$callback [as _callback] (c:\Users\Omer\Desktop\game\node_modules\ request-promise-core\lib\plumbing.js:46:31) 在 self.callback (c:\Users\Omer\Desktop\game\node_modules\request\request.js:188:22) 在 emmitOne (events.js) :116:13)在Request.emit(events.js:211:7)在Request.onRequestError(c:\ Users \ Omer \ Desktop \ game \ node_modules \ request \ request.js:884:8)在emitOne(事件.js:116:13)在ClientRequest.emit(events.js:211:7)在TLSSocket.socketErrorListener(_http_client.js:387:9)在emitOne(events.js:116:13)在TLSSocket.emit(事件) .js:211:7)在emitErrorNT(内部/streams/destroy.js:64:8)在_combinedTickCallback(内部/process/next_tick.js:138:11)在process._tickCallback(内部/process/next_tick.js: 180:9) 来自上一个事件:在 Request.plumbing.init (c:\Users\Omer\Desktop\game\node_modules\request-promise-core\lib\plumbing.js:36:28) 在 Request.RP$initInterceptor [as init] (c:\Users\Omer\Desktop\game\node_modules\request-promise-core\configure\request2.js:41:27) 在新请求 (c:\Users\Omer\Desktop\game\node_modules) \request\request.js:130:8) 在请求 (c:\Users\Omer\Desktop\game\node_modules\request\index.js:54:10) 在 requestStats (c:\Users\Omer\Desktop\game) \modules\utils\crawlers\stats\nba.stats.crawler.js:23:12) 在 Object.crawl (c:\Users\Omer\Desktop\game\modules\utils\crawlers\stats\nba.stats.crawler .js:12:12) 在 Object.crawl (c:\Users\Omer\Desktop\game\modules\utils\crawlers\stats\stats.crawler.js:20:20) 在 Object.runCrawl (c:\Users) \Omer\Desktop\game\modules\utils\crawlers\utils.crawler.js:27:18) 在 startCrawl (c:\Users\Omer\Desktop\game\scripts\useful\crawl.js:19:13) loadConfig (c:\Users\Omer\Desktop\game\scripts\useful\crawl.js:12:5) 在 c:\Users\Omer\Desktop\game\config\lib\mongoose.js:35:21 处process._tickCallback(内部/process/next_tick.js:188:7)”
我的代码:
var path = require('path'),
request = require('request-promise'),
format …Run Code Online (Sandbox Code Playgroud)