Add Support for Handling Long Tweets with note_tweet
Field
#312
Labels
enhancement
New feature or request
note_tweet
Field
#312
Title: Add Support for Handling Long Tweets using
note_tweet
FieldDescription
For long tweets, the default
Tweet.text
field only contains the initial part of the tweet, with the rest being replaced by "...".To handle the issue, twitter recently introduced a feature to obtain the full text of long tweets by including the
note_tweet
field in the request parameters when fetching tweets.Our library should support this new API feature.
Steps to Reproduce
Make a request to the Twitter API for a tweet longer than 280 characters.
We can see in the response the tweet text is truncated, with the remainder replaced by "...".
Example Request:
Response:
Expected Behavior
Twitter has introduced a new feature to obtain the full text of long tweets by including the
note_tweet
field in the request parameters. By addingnote_tweet
totwitter_field
, the response will include the complete tweet innote_tweet.text
.Our library should support this new API feature.
Reference:
How do I get extra long tweet text via V2 api? - Twitter API / Twitter API v2 - X Developers
GET /2/tweets/:id | Docs | Twitter Developer Platform (x.com)
GET /2/tweets/search/recent | Docs | Twitter Developer Platform (x.com)
Example Request:
Response:
Solution Proposed:
To support the handling of long tweets, modify the
TweetField
structure and theTweet
structure in our library:Add
TweetFieldNoteTweet
as an availableTweetField
when submitting a request:Update the
Tweet
structure to include theNoteTweet
field:Pull Request related:
I have made the necessary changes and completed testing to ensure the solution works as expected. The test code and results are provided in the linked pull request.
Pull Request: PR #313
As a newcomer to the open-source community, I am open to feedback and suggestions to improve this contribution. Thank you!
The text was updated successfully, but these errors were encountered: