This project has moved. For the latest updates, please go here.

number of followers

May 17, 2011 at 2:46 AM

joe, hi

This is the code I use to get a logged in users followers:

(from user in twitterCtx.User     

           where user.Type == UserType.Followers && user.ID== myuser   

             select new TwitterUserInfo                 {             

       ImageUrl = user.ProfileImageUrl,             

       ScreenName = user.Identifier.ScreenName,           

         TwitterId = user.Identifier.UserID           

     })                .ToList();


What is the maximum number of followers this code can show.

If I have a user with a million followers, can this code support that.



May 17, 2011 at 1:17 PM

Hi Arnab,

You would use cursors, which allows you to page through the results.  Here's an example (you'll need to scroll down the page to find the cursors example):


Jun 4, 2011 at 9:27 AM

Thanks Joe,

How many followers/friends can I get each time?



Jun 4, 2011 at 6:23 PM

Up to 100, but I just noticed that Twitter deprecated this part of their API and are recommending that you use a combination of followers/ids and users/lookup instead.

In LINQ to Twitter, this translates into using a SocialGraph entity with FriendshipType.Followers ( and then using the Users entity with UserType.Lookup (

I think Twitter's guidance could probably lead to better performance too because you can grab all the IDs pretty quick.  Your initial lookup on User entities will take some time, but you can cache that data (or save it to database) and only update as needed thereafter.  Also, consider that doing the deprecated UserType.Followers lookup brings back all of a user's data every time, which is less efficient and less scalable.


Jun 5, 2011 at 7:33 AM

ok, so I can get followers ids using social graph and cursors every page giving me 100 records.

I can also get user's name and  screenname using user lookup from Ids (upto 100 ids in each query).

Now I think I could add custom code as you have shown in user lookup :


foreach (follower f in followers)
var users =
                (from user in twitterCtx.User
                 where user.Type == UserType.Lookup &&
                       user.UserID == f.UserID
                 select user).ToList();


But as user lookup allows to add more than 1 id , I would prefer if i could do user.UserID==f1.UserID,f2.UserID,etc...

I would appreciate if you could tell me the best and right way to do this.





Jun 5, 2011 at 6:24 PM

UserID is a string, so you can do something as simple as:

string userIDs = userID1 + "," + userID2 + "," + ... + "," + userIDN;

but I would probably approach it by getting userIDs into an array and doing a join, like this:

string[] userIDs = // is popuplated by your logic that determines what userIDs you want

string userIDList = string.Join(",", userIDs);

var users =
                (from user in twitterCtx.User
                 where user.Type == UserType.Lookup &&
                       user.UserID == userIDList
                 select user).ToList();