pythontwittertweepyreply

How to search twitter replies more than a month using tweepy.api?


I'm trying to find replies to a specific user of a specific tweet ID using code:

tweets = tweepy.Cursor(api.search,q='to:'+name, tweet_mode='extended').items()

tweets_list = [[tweet.created_at, tweet.id, 
                tweet.full_text.encode('utf-8'), 
                tweet.in_reply_to_status_id_str] for tweet in tweets]

tweets_df = pd.DataFrame(tweets_list,columns=['Datetime', 'Tweet Id', 'Text', 'Reply_ID'])

tweets_df2 = tweets_df[tweets_df['Reply_ID'] == tweet_id]

I'm using 'to:'+name to find replies to a specific user and tweets_df['Reply_ID'] == tweet_id to match the replies. However, the result of the initial data frame tweets_df before filtering the tweet ID only gives the reply tweets within a month.

How can I get more replies starting from the 25-Jan?


Solution

  • The legacy standard Twitter search API - which is what this Tweepy function is using - can only provide Tweets going back within the past 7 days. For a longer period, you need to use the premium 30-day or full-archive search APIs from Twitter.