tweetinvi流不工作.netcore

时间:2018-03-09 07:44:58

标签: c# asp.net-core-2.0 tweetinvi

流媒体根本不工作。虽然我可以从应用程序发推文,但根本不能流数据。可能有什么不对? 已禁用error swallowing但仍未显示任何异常。

         //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);
        }

0 个答案:

没有答案