How to get follower that i dont already have

Mar 11, 2012 at 2:33 AM

I have tried many ways to get a single follower of a given user, that I am not already following.

I tried getting the complete list of followere of the given user and the complete list of my friends, but run into limits problems as well as errors.

I tried variouse attempts like this below, but get a must set type error.

Has anyone have an example on how to acomplish this?

 Thanks

Dim uTemp As LinqToTwitter.User = Me.TwitterCtx.User _

                       .Single(Function(w) w.Type = UserType.Followers AndAlso _

                                 w.ScreenName = ScreenName AndAlso _

                                  Not Me.TwitterCtx.User _

                       .Where(Function(wi) wi.Type = UserType.Friends AndAlso wi.ScreenName = "auser").Select(Function(s) s.ScreenName).Contains(w.ScreenName))

Coordinator
Mar 11, 2012 at 7:20 PM

Hi Alan,

I handle these situations like this:

  1. Use SocialGraph API because it lets you work with ID's rather than normal objects, which is faster. Make sure you max out the page size to minimize the number of queries.  There are examples in the downloadable code.
  2. Get the list of IDs of all your followers.
  3. Get the list of IDs of all the other person's followers.
  4. Use the LINQ Except operator to find the the other person's follower IDs that aren't in your follower IDs.

Hope this helps,

Joe

Mar 11, 2012 at 8:16 PM

Thanks joe, One think still not clear is how to max out pagesize. i could not find pagesize with socialgraph, only with the search object, am i missing something here?

Coordinator
Mar 11, 2012 at 9:25 PM

You're right, there isn't a way to specify the number of items per request - some APIs do and others don't.

Joe

Mar 12, 2012 at 3:44 AM

Thanks, working much faster using socialgraph