12

So i am stuck trying to figure out how to retweet a tweet with a comment, this was added to twitter recently.

this is when you click retweet and add a comment to the retweet and retweet it. basically this is what i am talking about :

enter image description here

i was looking at the api and count find a method dedicated to this. And even the retweet method does not have a parameter where i can pass text.

So i was wondering is there a way to do this?

user4335407
  • 352
  • 1
  • 3
  • 11
  • Strange update_status is working for me. Did you try `api.update_status(stat_forme, tweet_cid)` because its throwing a syntax error using your code – Harwee Nov 09 '15 at 23:31
  • `api.update_status(stat_forme, tweet_cid)` works `api.update_status(stat_forme)` doesn't work... 403 bad request but if i add status like this it works `api.update_status(status=stat_forme)` – user4335407 Nov 09 '15 at 23:41

3 Answers3

16

Tweepy doesn't have functionality to retweet with your own text, but what you can do is make a url like this https://twitter.com/<user_displayname>/status/<tweet_id> and include it with the text you want comment. It's not a retweet but you are embedding the tweet in your new tweet.

user_displayname - display name of person, whose tweet you are retweeting

tweet_id - tweet id of tweet you are retweeting

Harwee
  • 1,601
  • 2
  • 21
  • 35
  • Update for those that wander in like me, Tweepy now (2020) has retweet functionality. http://docs.tweepy.org/en/latest/api.html#API.retweet – Mark Apr 06 '20 at 16:16
  • 1
    Just starting using tweepy but what it didn't exist (and still doesn't) is the functionality to retweet with a comment. From what they say in the question and answer, I think the plain retwwet already existed – virgiliogm Jul 16 '20 at 13:03
4

September 2021 Update

Tweepy does have the functionality to quote retweet. Just provide the url of the tweet you want to quote into attachment_url of the API.update_status method.

Python example:

# Get the tweet you want to quote
tweet_to_quote_url="https://twitter.com/andypiper/status/903615884664725505"

# Quote it in a new status
api.update_status("text", attachment_url=tweet_to_quote_url)

# Done!
David
  • 2,109
  • 1
  • 22
  • 27
0

In the documentation, there is a quote_tweet_id parameter in create_tweet method.

You can create a new tweet with the tweet ID of the tweet you want to quote.

comment = "Yep!"
quote_tweet = 1592447141720780803

client = tweepy.Client(bearer_token=access_token)
client.create_tweet(text=comment, quote_tweet_id=quote_tweet, user_auth=False)
Ashyam
  • 666
  • 6
  • 13