Filtered Stream if he/she follow and i follow him/her

Nov 25, 2014 at 3:07 AM
Morning linvi, can u figured it out how to filter stream if the result follow my account?
thank you..
Nov 25, 2014 at 3:34 AM
Edited Nov 25, 2014 at 4:55 AM
i see this method:
stream.AddFollow(Iuser user).
what exactly value that i must fill the user variable.

or maybe stream.FollowingUserIds=??
i don't know how to initialize list for that.
please help me out.

thanks in future.
Nov 25, 2014 at 6:10 PM

I am not sure that I understand what you are willing to do.
From my understanding you want to get the tweets from a specific set of users.

If this is the case you can add each of the followers you have to this list.
var currentUser = User.GetLoggedUser();
var followerIds = currentUser.GetFollowerIds();

var fs = Stream.CreateFilteredStream();
followerIds.ForEach(id => fs.AddFollow(id));
Nov 26, 2014 at 7:24 AM
hi linvi, thanks for respon.
for example i have account with id=12321313;
when i do stream i want every tweet that i got must be follow my account and i follow that account. that's it.

i'll try your code, seems similar.
Dec 2, 2014 at 8:05 PM
Sorry I don't understand what you are willing to achieve :s
Dec 11, 2014 at 7:39 AM
hi linvi,
i've try this line:
followerIds.ForEach(id => fs.AddFollow(id));

it getting error on ForEach.

i'll try to explain hope you will understand now linvi.
i have account with screenname ismansantoso.
i run stream using secret, consumer, token id from screenname ismansantoso
and i have some follower for example about 100 follower.

i want the stream only stream for only 100 follower of ismansantoso that's it!!! :D

i found some method from your class that maybe can i use, but i don't understand how to set the value.
stream.AddFollow(Iuser user).
(how to set <dictionary>long??)

thank you linvi in future... :D
Dec 11, 2014 at 8:07 AM
hi linvi, i've figure out how to solve my problem:

public void bgw_DoWork(object sender, DoWorkEventArgs e)
        var currentUser = User.GetLoggedUser();
        var followerIds = currentUser.GetFollowerIds();
        var stream = Stream.CreateFilteredStream();

        foreach (long id in followerIds)
        stream.MatchingTweetReceived += stream_MatchingTweetReceived;
but i get problem, not a problem in code. the problem is, only follower that follow me before i start stream will be included. :D. any new follower after i start stream will not included. :D
Marked as answer by santosoisman on 12/11/2014 at 12:07 AM
Dec 11, 2014 at 9:25 AM
Maybe you want to use the UserStream:
var followerIds = new HashSet<long>(User.GetFollowerIds("me"));
var us = Stream.CreateUserStream();
us.TweetCreatedByAnyoneButMe += (sender, args) =>
    var tweet = args.Tweet;
    var creator = tweet.Creator;
    var creatorId = creator.Id;

    if (followerIds.Contains(creatorId))
        // My code

us.FollowedByUser += (sender, args) =>
    Console.WriteLine("Mr {0} is now following you!", args.User.ScreenName);