Twitter api:更新正常,但过滤器不支持javascript twitter oauth twitter-api jsoauth
在下面的代码中,我通过bytespider从jsOAuth库中实例化了一个OAuth实例
// jsoauth API reference:
// http://bytespider.github.com/jsOAuth/api-reference/
var twitter = new OAuth(oauthOptions);
//authentication occurs
console.log('url: ' + url);
console.log('data: ' + JSON.stringify(data));
twitter.post(
url,
data,
success,
failure
);当我访问流时:
url: https://stream.twitter.com/1/statuses/filter.json
data: {"track":"%40twitterapi"}
--> This does not work, neither the `success` nor `failure` callbacks get called, just hangs当我发推文的时候:
url: https://api.twitter.com/1/statuses/update.json
data: {"status":"foobar","trim_user":true,"include_entities":true}
--> This works, the `success` callback gets called我的猜测是,身份验证细节没有传递到stream.twitter.com应用程序接口,即使它传递到api.twitter.com应用编程接口。可以安全地排除OAuth问题,因为能够发送tweet表明身份验证已经成功。
我在这里做错了什么?
谢谢!
发布于 2012-07-07 18:58:29
不是那样的
这不起作用,
success和failure回调都不会被调用,只是挂起
因为您使用的是Streaming API,它意味着“挂起”,因为使用它意味着您打开了一个到Twitter服务器的连接,该连接将在应用程序运行期间保持活动状态。然后,每条新的推文都会被实时发送到这个连接上,就像水通过管道一样。
您应该考虑使用HTML5 WebSockets。
https://stackoverflow.com/questions/11372835
复制相似问题