使用最新的 Twitter REST API v1.1 获取 Twitter 对话是否有任何解决办法

使用最新的 Twitter REST API v1.1 获取 Twitter 对话是否有任何解决办法

问题描述:

我正在处理一个需要检索 Twitter 用户对话的项目.例如,我想获得 BBC World Service 这条推文的所有回复.使用 REST API v1.1 我可以获得时间线(推文,重新推文)推特用户.但是我没有找到任何文档/工作来获取特定推文的回复.是否有任何解决方法来获取特定推文的回复?

I am working on a project where the conversation of a twitter user needs to be retrieved. For example i want to get all the replies of this tweet of BBC World Service. Using the REST API v1.1 i can get the timeline (tweet, re-tweet) of a twitter user. But i did not find any documentation/working work around on fetching replies of a specific tweet. Is there any work around on getting the replies of a specific tweet at all?

没有 API 调用来获取对特定推文的回复.但是,您可以作弊!

There is no API call to get replies to a specific tweet. You can, however, cheat!

使用 搜索 API,您可以构建搜索查询即:

Using the Search API you can construct a search query which is:

  • 回复@bbcworldservice.
  • 发生在推文发布之后.
  • 可选地,特定日期/时间之前.
  • In reply to @bbcworldservice.
  • Occurred after the tweet was posted.
  • Optionally, before a specific date / time.

所以,在这种情况下,就像

So, in this case, something like

https://api.twitter.com/1.1/search/tweets.json?
    q=%23bbcworldservice&
    since_id=489366839953489920&
    count=100

您将获得推文列表(最多 100 个).然后,您需要在它们中搜索 in_reply_to_status_id_str 并查看它是否与您要查找的状态匹配.

You'll get a list of Tweets (up to 100). You will then need to search them for in_reply_to_status_id_str and see if it matches the status you're looking for.