Access Tweets via conversation_id with Tweepy

Viewed 25

Twitter API v2.0 added a conversation_id which supposedly enables easier access to an entire Twitter thread. Previously this kind of work was done by accessing the original tweet and then keeping track of the in_reply_to_status_id field. This is easy for replies to the original tweet, but is more cumbersome for replies to replies.

I suspect I'm missing something simple and appreciate any help. The API documentation says the conversation_id will match the tweet_id of the tweet which started the original conversation. After applying my tokens, the search code is:

replies=[]
for tweet in tweepy.Cursor(api.search_tweets,q='conversation_id:<1565355188004741120>',timeout=999999).items(1000):
        replies.append(tweet)

However, the list replies returns empty. I know that conversation_id is valid because I've access the first level replies via legacy code. Any insight to using the conversation_id field is appreciated. There's surprisingly little information out there on its use. Thank you!

SOLUTION The issue was api v1.0 vs 2.0. The following works:

replies=[]
for tweet in tweepy.Paginator(client.search_recent_tweets, query='conversation_id:1565355188004741120'):
        replies.append(tweet)
0 Answers
Related