Get all followers using LINQ to Twitter

二次信任 提交于 2019-12-12 03:42:37

问题


I'm using LINQ to Twitter API for gathering followers for specific users on twitter. I am able to get all IDs, and with those IDs I can request their screen name and other properties I need.

I do this in a batch of 100 users (as I understand - 100 per request is the limit).

I'm also using oAuth.

So now I am able to get the info on 350 * 100 = 35000 followers.

What if a specific user has let's say 100000+ followers. How do I gather info on all of them?


回答1:


It sounds like you're already dong User Lookup, like this, but I mention it just in case:

        var users =
            (from user in twitterCtx.User
             where user.Type == UserType.Lookup &&
                   user.UserID== "123,456,789,...,777"
             select user)
            .ToList();

        users.ForEach(user => Console.WriteLine("Name: " + user.Name));

As you know, you're limited to 100 IDs at a time, meaning that you'll need to make a lot of requests, which will take a long time. Check out Twitter's rate limiting docs, which explain how many requests you can make and (more importantly) techniques that might help to avoid lower rate limits:

https://dev.twitter.com/docs/rate-limiting

In LINQ to Twitter, you can access rate limit info through the Headers and other properties on your TwitterContext instance right after a query.

Another potential option is to look at Twitter's Partner Providers to see if they have the data you need:

https://dev.twitter.com/docs/twitter-data-providers

Joe



来源:https://stackoverflow.com/questions/11224285/get-all-followers-using-linq-to-twitter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!