【问题标题】:How to find a set of users are following or followed by another particular user using the Twitter API?如何使用 Twitter API 查找一组用户正在关注或被另一个特定用户关注?
【发布时间】:2015-09-08 16:11:09
【问题描述】:

我想知道是否有任何 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 都作为朋友或追随者相互关联?

【问题讨论】:

    标签: api twitter twitter-follow


    【解决方案1】:

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

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

    为追随者使用追随者/ids 端点:

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

    这些返回 id 非常好,因为它速度很快,并且可以让您以较少的查询数量获取整个列表。

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

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

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

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

    没有用于管理图表的 API。

    【讨论】:

      猜你喜欢
      • 2018-05-14
      • 2015-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 1970-01-01
      相关资源
      最近更新 更多