Javascript 将pipl与Node.js一起使用

Javascript 将pipl与Node.js一起使用,javascript,node.js,Javascript,Node.js,我正在尝试使用。我编写了以下代码: router.post('/httpOnly/enrich/pipl', (req, res) => { var pipl = require('pipl')('BUSINESS-PREMIUM-DEMO-xyozhmgkc57085z7...'); pipl.search.query('json', {"email": "softtimur@gmail.com"}, function(err, data) { conso

我正在尝试使用。我编写了以下代码:

router.post('/httpOnly/enrich/pipl', (req, res) => {
    var pipl = require('pipl')('BUSINESS-PREMIUM-DEMO-xyozhmgkc57085z7...');
    pipl.search.query('json', {"email": "softtimur@gmail.com"}, function(err, data) {
        console.log(data);
        res.json(data)
    });
})
但是,它给出了一个错误:

index.js POST /httpOnly/enrich/pipl
http://api.pipl.com/search/v4/
/.../node_modules/pipl/lib/inherits.js:32
                    return callback(err, JSON.parse(body) || body);
                           ^

TypeError: callback is not a function
    at Request._callback (/.../node_modules/pipl/lib/inherits.js:32:28)
    at Request.self.callback (/.../node_modules/request/request.js:123:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/.../node_modules/request/request.js:893:14)
    at emitOne (events.js:120:20)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/.../node_modules/request/request.js:844:12)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
index.js POST/httpOnly/enrich/pipl
http://api.pipl.com/search/v4/
/…/node_modules/pipl/lib/inherits.js:32
返回回调(err,JSON.parse(body)| | body);
^
TypeError:回调不是函数
应请求。_回调(/…/node_modules/pipl/lib/inherits.js:32:28)
at Request.self.callback(/…/node_modules/Request/Request.js:123:22)
两次(events.js:125:13)
at Request.emit(events.js:213:7)
应要求。(/…/node_modules/request/request.js:893:14)
在emitOne(events.js:120:20)
at Request.emit(events.js:210:7)
在收到消息时。(/…/node_modules/request/request.js:844:12)
在emitNone(events.js:110:20)
在IncomingMessage.emit(events.js:207:7)
在endReadableNT(_stream_readable.js:1059:12)
at _combinedTickCallback(内部/流程/下一步_tick.js:138:11)
在进程中。_tick回调(内部/process/next_tick.js:180:9)
有人知道怎么回事吗?

从中可以看出,语法是:

pipl.search.query({"email": "softtimur@gmail.com"}, function(err, data) {
    console.log(data);
    res.json(data)
});
开头没有
'json'
字符串。我认为签名是在没有更新npm文档的情况下更改的


也请选中“提交”。

谢谢。。。我收到另一个错误
{'@http\u status\u code':403,错误:“此API密钥用于API版本5。您尝试使用版本4'}
@SoftTimur,我看到您在GitHub repo上出现了问题。您可以尝试在线删除v4/并查看是否有效。根据调查,看起来他们从URL中删除了这个版本。您使用的pipl库通常已过时,这就是问题所在。在我的本地
节点\u modules/pipl/lib/main.js
中删除该行确实解决了问题。现在,即使在安装了
sudo npm
之后,我怎么能保留这个版本呢?我必须制作一个bash来系统地替换该文件吗?@SoftTimur您可以在GitHub上分叉repo,在分叉repo中修复它并提交,然后链接到package.json中的GitHub repo。您不必发布到npm。您可以在package.json中使用github链接。例如,
“pipl”:https://github.com/softtimur/pipl/tarball/master“
。看见许可证是麻省理工学院的,所以你可以毫无问题地使用它。您只需保留评论中的版权声明。如果您还没有在GitHub上分叉,您可以查看。