In this article we will see how we can check whether a tweet/status has been retweeted by the authenticated user or not. The retweeted attribute of the Status object indicates whether the status has been retweeted by the authenticated user or not.
Identifying whether the status has been retweeted by the authenticated user or not in the GUI :
👁 Image
In the above mentioned status, the retweet icon is in green color, therefore the authenticated user has retweeted the tweet.
In order to check whether the status has been retweeted by the authenticated user or not, we have to do the following :
- Identify the status ID of the status from the GUI.
- Get the Status object of the status using the
get_status() method with the status ID.
- From this object, fetch the retweeted attribute present in it.
Example 1 : Consider the following status :
👁 Image
We will use the status ID to fetch the status. The status ID of the above mentioned status is 1272771459249844224.
Output :
The authenticated user has not retweeted the tweet.
Example 2 : Consider the following status :
👁 Image
We will use the status ID to fetch the status. The status ID of the above mentioned status is 1272479136133627905.