使用LINQ to Twitter获取所有关注者 [英] Get all followers using LINQ to Twitter

查看:71
本文介绍了使用LINQ to Twitter获取所有关注者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用LINQ to Twitter API来收集Twitter上特定用户的关注者. 我可以获取所有ID,并可以使用这些ID请求其屏幕名称和所需的其他属性.

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.

我每100个用户执行一次此操作(据我了解-每个请求最多100个).

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

我也在使用oAuth.

I'm also using oAuth.

所以现在我能够获得有关350 * 100 = 35000个关注者的信息.

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

如果某个特定用户拥有100000多个关注者,该怎么办.如何收集所有信息?

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

推荐答案

听起来像您已经是dong User Lookup了,但是,我以防万一:

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));

如您所知,一次只能使用100个ID,这意味着您需要进行大量请求,这将花费很长时间.查看Twitter的限速文档,该文档解释了您可以发出多少个请求以及(更重要的是)可以帮助避免降低限速的技术:

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

在LINQ to Twitter中,您可以在查询后立即通过TwitterContext实例上的Header和其他属性访问速率限制信息.

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

另一个可能的选择是查看Twitter的合作伙伴提供商,以查看他们是否拥有您需要的数据:

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

这篇关于使用LINQ to Twitter获取所有关注者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆