如何使用 Twitter API 查找一组用户正在关注或被另一个特定用户关注?

How to find a set of users are following or followed by another particular user using the Twitter API?

我想知道是否有任何 Twitter API,通过它我可以了解一组用户是否关注或被特定用户关注。

例如:

set_of_users are: { a,b,c}
particular user is: d

Then the result is a kind of

a:
following: true //(means a is following d)
friend: true //(means d is following a)

b:
following: false //(means b is not following d)
friend: false // (means

c:
following: false //(means c is not following d)
friend: true //(means c is following d)

另外,有些API告诉它a、b、c、d都作为朋友或追随者相互联系?

您可以为好友使用 friends/ids 端点:

https://dev.twitter.com/rest/reference/get/friends/ids

对关注者使用 followers/ids 端点:

https://dev.twitter.com/rest/reference/get/followers/ids

这些 return id,这很好,因为它速度快,并且可以让您使用较少数量的查询拉入整个列表。

获得 ID 后,使用 users/lookup 端点提取用户数据。它有一个 user_id 参数,您可以使用该参数通过逗号分隔的 id 列表一次收集多个用户记录:

https://dev.twitter.com/rest/reference/get/users/lookup

如果您是新手,应该访问 Twitter 文档页面并查看概述和最佳实践。这些将回答您的许多问题。例如您将要执行的查询类型可能会导致您遇到速率限制,因此请仔细阅读,以后会避免很多挫败感。

https://dev.twitter.com/overview/documentation

没有 API 来管理图表。