简体   繁体   English

Tweepy 不检索旧的提及

[英]Tweepy not retrieving older mentions

I'm on an academic twitter API license and I am trying to retrieve older mentions of particular users using Tweepy.我有一个学术 twitter API 许可证,我正在尝试使用 Tweepy 检索特定用户的旧提及。 When I add my start_time en end_time parameters to the query for a random user ID (in this case twitter.com/twitter), I get an empty response object that doesn't contain a single tweet.当我将 start_time 和 end_time 参数添加到随机用户 ID 的查询中时(在本例中为 twitter.com/twitter),我得到一个空响应 object,其中不包含一条推文。 How can I get this to work?我怎样才能让它工作?

# Replace with time period of your choice
start_time = '2017-01-01T00:00:00Z'

# Replace with time period of your choice
end_time = '2017-01-31T00:00:00Z'

mentions = client.get_users_mentions("783214", start_time=start_time, end_time=end_time, max_results=10)

The GET /2/users/:id/mentions endpoint (which is used by the get_users_mentions method) can return only the last 800 mentions. GET /2/users/:id/mentions端点(由get_users_mentions方法使用)只能返回最后 800 次提及。 You can read that in the API documentation here .您可以在此处的 API 文档中阅读该内容。

But since you have an academic access, you can use the GET /2/tweets/search/all endpoint (with the Tweepy search_all_tweets method ) to search for the public mentions of the user.但是由于您拥有学术访问权限,您可以使用GET /2/tweets/search/all端点(使用 Tweepy search_all_tweets 方法)来搜索用户的公开提及。

You can find help to build your query in the Twitter API documentation here .您可以在此处的 Twitter API 文档中找到构建查询的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM