流媒体根本不起作用。虽然我可以从应用程序发推文,但根本不能流式传输数据。有什么问题?
禁用错误吞咽,但仍然没有显示任何异常。
//authenication
Auth.SetUserCredentials("XXXXXXX", "XXXXXX", "XXXXXX", "XXXXXX");
// Publish the Tweet "Hello World" on your Timeline
// Tweet.PublishTweet("InternationalWomensDay!");
ExceptionHandler.SwallowWebExceptions = false;
TweetinviConfig.CurrentThreadSettings.TweetMode = TweetMode.Extended;
// Execute an operation
try
{
var authenticatedUser = User.GetAuthenticatedUser(null, new GetAuthenticatedUserParameters());
var stream = Stream.CreateFilteredStream();
stream.AddTrack("Kim Jong Un");
// stream.MatchOn = MatchOn.TweetText;
stream.AddTweetLanguageFilter(LanguageFilter.English);
Console.WriteLine("I am listening to twitter");
stream.StallWarnings = true;
stream.MatchingTweetReceived += (sender, arguments) =>
{
Console.WriteLine(arguments.Tweet.Text);
};
stream.StartStreamMatchingAllConditions();
}
catch (ArgumentException ex)
{
//Something went wrong with the arguments and request was not performed
Console.WriteLine("Request parameters are invalid: '{0}'", ex.Message);
}
catch (TwitterException ex)
{
// Twitter API Request has been failed; Bad request, network failure or unauthorized request
Console.WriteLine("Something went wrong when we tried to execute the http request : '{0}'", ex.TwitterDescription);
}