我正在使用 TweetInvi Streaming API 来观看我的 Twitter 时间线,并在每次有人用“AREA2017”这个词发推文时向我发送一封邮件;
这是我到目前为止的地方:
Auth.SetUserCredentials("consumerkey", "consumersecret", "accesstoken", "accesstokensecret");
var user = Tweetinvi.User.GetAuthenticatedUser();
var stream = Stream.CreateFilteredStream();
stream.AddTrack("AREA2017");
stream.MatchingTweetReceived += (sender, arguments) =>
{
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 25;
client.Credentials = new NetworkCredential("somemail@gmail.com", "mygmailpassword");
client.EnableSsl = true;
client.Send(new MailMessage("somemail2@gmail.com", "somemail2@gmail.com", "Hi !", "body"));
Console.WriteLine(arguments.Tweet.Text);
};
stream.StartStreamMatchingAllConditions();
所以,我不太清楚为什么它不起作用,我按照本教程进行操作: https ://www.youtube.com/watch?v=e-lJm-bqyI0 +
我检查了用我的代码向我发送一封邮件,它运行良好,api 只是找不到任何包含“AREA2017”的推文。