我在c#中使用tweetinvi获取推文流以供分析,有没有办法可以获得实时或实时过滤的推文
答案 0 :(得分:1)
我是Tweetinvi的开发者。我不确定yoiur是否阅读了Filtered Stream documentation。
但是你可以用几行来做你想做的事情:
var stream = Stream.CreateFilteredStream();
// Add all your filters with AddTrack
stream.AddTrack("tweetinvi");
stream.AddTrack("rest");
stream.MatchingTweetReceived += (sender, args) =>
{
// This event will be invoked every time a tweet created is matching your criteria
var tweet = args.Tweet;
// If you want to get all the matching values
var matchingTracks = args.MatchingTracks;
var matchingFollowers = args.MatchingFollowers;
var matchingLocations = args.MatchingLocations;
// If you want to know which criteria has matched
var matchedOn = args.MatchOn;
};
stream.StartStreamMatchingAllConditions();