how to get full tweet text for rwClient.v2.search( ) #269
Answered
by
alkihis
MarufRien1
asked this question in
Q&A
-
i am trying to get the full text of the tweets returned by rwClient.v2.search( ) function. how can I fix this problem |
Beta Was this translation helpful? Give feedback.
Answered by
alkihis
Apr 25, 2022
Replies: 2 comments
-
it's because they're retweets, and retweets are truncated following the 140 chars convention. You need to ask for retweeted status aside with your request: const search = await client.v2.search('My search text', { expansions: ['referenced_tweets.id'], 'tweet.fields': ['referenced_tweets'] })
for await (const tweet of search) {
// Get the retweet object obtained from `includes.tweets` in response object
const retweet = search.includes.retweet(tweet)
// If retweet object found, use its text (bc its a retweet), otherwise use original tweet text
const fullText = retweet ? retweet.text : tweet.text
// Use {fullText}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MarufRien1
-
Thank you 😊 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it's because they're retweets, and retweets are truncated following the 140 chars convention.
You need to ask for retweeted status aside with your request: