skip to Main Content

anyone knows how to get a the relys for a specific tweet by it’s ID maybe? i been trying but can’t find any on the tweepy docs not discord’s, can’t seem to find anything about how to do it with twitter api v2, also is there a way to requests latest tweets from multiple users in bulk?

import tweepy
twitter_client = tweepy.Client(bearer_token=bearer)
all_tweets = twitter_client.get_users_tweets(id=(1334299956241461248,1346973288040263680,154449778,1516418305455763466))
print(all_tweets)

this is how i try it, but it’s returning me an error

The `id` query parameter value [(1334299956241461248, 1346973288040263680, 154449778, 1516418305455763466)] is not valid

any help appreiciated, and thank you

2

Answers


  1. Chosen as BEST ANSWER

    and i found the answer at the end

    def check_replys(tweet_ID):
        query = f"conversation_id:{tweet_ID} is:reply"
        replys= twitter_client.search_recent_tweets(query= query )
        return replys
    

    you can find more info about making a query at https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query


  2. You’re asking two questions:

    1. How to get replies by Tweet ID
    2. How to lookup the latest Tweets for several users

    For 1 – you can search for Tweets by conversation ID. The conversation ID is the ID of the original Tweet that led to the replies. The only wrinkle here is that by default (v2 Essential access) you can only search for Tweets within the past 7 days, so if the Tweet you want replies for is older than that, you’ll need Academic access for full archive search.

    For 2 – you cannot pass multiple values to the id parameter all at once. If you look at the Tweepy documentation and at the Twitter API docs, you’ll see that id gets substituted into the URL path for the call, so you have to call the API multiple times, one for each user ID. That should be possible using a loop.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search