Get original tweet ID from retweet #266
Unanswered
nmduarteus
asked this question in
Q&A
Replies: 1 comment
-
Hi, const originalTweet = await client.v2.singleTweet('20', { expansions: ['referenced_tweets.id'], 'tweet.fields': ['referenced_tweets'] })
// Without includes helper,
const rtID = originalTweet.data.referenced_tweets?.find(r => r.type === 'retweeted')?.id
if (rtID) {
console.log('RT ID', rtID)
} else {
console.log('Not a RT')
}
// With includes helper
const includes = new TwitterV2IncludesHelper(originalTweet)
const retweet = includes.retweet(originalTweet.data)
if (retweet) {
console.log('This is a RT, data:', retweet) // id is in {retweet.id}
} else {
console.log('Not a RT, tweet data:', originalTweet.data)
} |
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
-
While looking at tweets (that can be retweets) I would like to see/know the original tweet ID. is that possible?
Example:
The Tweet text will show something like
"text": "RT @ABC: Thank you!"
- One could assume that if the tweet text starts withRT @handler
then it means it's a retweet. But is there any way of retrieving which tweet was retweeted?Thank you!
Beta Was this translation helpful? Give feedback.
All reactions