In this article we will see how we can get the text of a status/tweet. A tweet can only have a maximum of 280 characters. The text attribute of the Status object provides us with the text of the status.
Identifying the text of the status in the GUI :
๐ Image
In the above mentioned status, the text of the status is :
A programmerโs takeaway from the pandemic: Local variables over Global variables.
What do you think?
.
.
.
.
.
#programming #coding #programmingmemes #Covid_19 #codinglife #Python #javascript
#pandemic #thursdayvibes
In order to get the text of the status, 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. If we want to get the complete text, pass another parameter tweet_mode = "extended".
- From this object, fetch the text attribute present in it. If we want to get the complete text, fetch the attribute full_text.
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 text of the status is :
Which movie did you watch recently?
Reply us!
.
.
.
.
.
#tuesdaymood #TuesdayThoughts #Bollywood #Hollywood #genre
#movies #movie #fun
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. This time we will be fetching the complete text of the status. While using the
get_status() method also pass
tweet_mode = "extended" as a parameter. Then fetch the complete text using the full_text attribute.