Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: distinguishing Track from Follow

$
0
0
Imlokesh is right, a Tweet can be matching both a Track and a Follow.

Therefore you can get this information easily by checking the Creator Id of a Tweet.
var ids = new HashSet<long>( /* Put your follower ids here */ );

var fs = Stream.CreateFilteredStream();
ids.ForEach(id => fs.AddFollow(id));

fs.MatchingTweetReceived += (sender, args) =>
{
    var tweet = args.Tweet;
    var followerId = tweet.Creator.Id;

    if (ids.Contains(followerId))
    {
        // Follower posted this tweet
    }
};

fs.StartStreamMatchingAnyCondition();
Please note that I am using a HashSet and its .Contains method for obvious performance issues.

Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>