【问题标题】:Query conversation_id with tweepy recent search to obtain tweet responses使用 tweepy 最近搜索查询 conversation_id 以获得推文响应
【发布时间】:2022-06-29 15:09:51
【问题描述】:

根据 Twitter API 文档,conversation_id 可用于获取线程。为此,应在推文搜索查询 (https://developer.twitter.com/en/docs/twitter-api/conversation-id) 中使用 conversation_id。 Twitter API 文档还说,conversation_id 应该在搜索推文查询中使用,如下所示:

我使用 tweepy 来获取类似这样的推文搜索结果,并且效果很好:

tweepy.Paginator(client.search_recent_tweets,
                              query = 'covid19 lang:cs OR corona lang:cs OR korona lang:cs OR covid lang:cs OR kovid lang:cs OR koronavirus lang:cs \
                                        OR koronavir lang:cs OR coronavirus lang:cs', 

但是,使用带有 conversation_id 的这段代码作为查询不起作用 - 有谁知道为什么会出现这种情况?

responses_from_conversations = []
for response in tweepy.Paginator(client.search_recent_tweets,
                              query = 'conversation_id:1494772850527457289',):
                              
                            responses_from_conversations.append(response)

【问题讨论】:

    标签: twitter tweepy twitterapi-python


    【解决方案1】:

    我使用了user_auth = True,然后它起作用了。

    responses_from_conversations = []
    for response in tweepy.Paginator(client.search_recent_tweets,
                                  query = 'conversation_id:1494772850527457289', user_auth = True):  
        responses_from_conversations.append(response)
    

    【讨论】:

      猜你喜欢
      • 2020-03-30
      • 1970-01-01
      • 2015-03-31
      • 2022-08-19
      • 2017-02-18
      • 2021-02-25
      • 1970-01-01
      • 2013-09-05
      • 2017-12-26
      相关资源
      最近更新 更多