0

我正在尝试 nTwitter (nodejs v0.6.10) - 我尝试使用示例代码搜索 twitter,但在尝试库的搜索功能时出现以下错误(我使用的键似乎是正确的):

无法将属性“q”设置为 null

任何可能导致此问题的想法 - 堆栈跟踪被复制到下面(代码也是如此)?

//twit is instance of Twitter (with keys assigned in)
twit.search('nodejs', function(err, data) {

if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});

在 Object.merge (/opt/testDir/node/node_modules/ntwitter/lib/utils.js:9:18) 在 Twitter.search (/opt/testDir/node/node_modules/ntwitter/lib/twitter.js:167: 18) 在 Object.search (/opt/testDir/node/projects/testApp/public/javascripts/nTwitterTest.js:13:6) 在 nTwitterTestMediator (/opt/testDir/node/projects/testApp/app.js:1188: 14) 在回调 (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index.js:272:11) 在参数 (/opt/testDir/node/projects/testApp/node_modules/express/ lib/router/index.js:246:11) 在 Router._dispatch (/opt/ testDir/node/projects/testApp/node_modules/express/lib/router/index.js:280:4) 在 Object.handle (/opt/testDir/node/projects/testApp/node_modules/express/lib/router/index. js:45:10)在下一个(/opt/testDir/node/projects/testApp/node_modules/connect/lib/http.js:201:15)

Pilot 错误 - twitter 上的设置未更新(从只读到读写执行)。我切换到读取和写入(而不是读取、写入和执行)并且设置更改(这是由于我对 twitter api 和权限级别的无知)。

我能够发布推文以及使用 twitter 应用程序的读写访问级别访问流 API(使用 github 页面上的代码)。

我仍然无法使用搜索功能(下面的代码)。

twit.search('nodejs', function(err, data) {
if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});

谢谢

4

2 回答 2

1

我也有这个问题。您缺少一个参数。

尝试这个:

twit.search('nodejs', {}, function(err, data){ 

我认为这是原始 ntwitter 文档中的错误。

于 2012-05-21T23:17:10.090 回答
0

Pilot 错误 - twitter 上的设置未更新(从只读到读写执行)。
我切换到读取和写入(而不是读取、写入和执行)并且设置更改(这是由于我对 twitter api 和权限级别的无知)。

我能够发布推文以及使用 twitter 应用程序的读写访问级别访问流 API(使用 github 页面上的代码)。

我仍然无法使用搜索功能(下面的代码)。

twit.search('nodejs', function(err, data) {
if (err) {
console.log('Twitter search failed!');
}
else {
console.log('Search results:');
console.dir(data);
}
});

谢谢。

于 2012-04-17T20:26:59.733 回答