1

我正在使用swhitley 的 Twitter Stream Client通过 Twitter Streaming API 使用用户名和密码下载推文。它正在使用https://stream.twitter.com/1.1/statuses/filter.json

我修改了代码以添加 OAuth,但出现 400 错误。任何人都可以提供我的代码或指导我到一个开源项目。或者只是给我一些关于如何解决问题的提示。

4

1 回答 1

2

如果您的 API 遇到问题,可以尝试使用Tweetinvi

该 API 由我和另一位开发人员开发,目的是使用 Streaming API。

它非常易于使用,您可以在解决方案 (Examplinvi) 中找到示例。

基本上,您只需要定义一个方法,该方法将在从 API 收到的 Tweet 中调用。我们已经能够使用这个 API(存储在 MySQL 数据库中)每天处理 350 万条推文。

// Creating the stream and specifying the delegate
SimpleStream myStream = new SimpleStream("https://stream.twitter.com/1.1/statuses/sample.json");
// Create the credentials
IToken token = new Token("userKey", "userSecret", "consumerKey", "consumerSecret");
// Starting the stream by specifying credentials thanks to the Token
myStream.StartStream(token, x => Console.WriteLine(x.Text));

如果您需要任何帮助,请随时问我。

于 2013-06-23T23:24:25.843 回答