ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

How to get extended tweets for Retweets? #453

Open zacharisharris opened 6 years ago

zacharisharris commented 6 years ago

I managed to get full_text(280) on simple tweets, but it doesn't work on retweets. Can someone tell me how I can get it to work?

dandv commented 6 years ago

Twitter incorrectly returns "full_text" truncated to 140 characters on the retweet. To get the full text of the original tweet, look in the .retweeted_status.full_text property.

I've made an example for you.

wobsoriano commented 5 years ago

I use this function to get the complete final FULL text.

function getCompleteText(tweet) {
    let result;

    if (tweet.retweeted_status) {
        if (tweet.retweeted_status.full_text) {
            result = tweet.retweeted_status.full_text;
        } else if (tweet.retweeted_status.extended_tweet) {
            result = tweet.retweeted_status.extended_tweet.full_text;
        } else {
            result = tweet.text;
        }
    } else {
        result = tweet.full_text || tweet.text;
    }

    return result;
}
mapodev commented 4 years ago
function getCompleteText(tweet) {
    let result;

    if(tweet.extended_tweet) {
        result = tweet.extended_tweet.full_text;
    } else if (tweet.retweeted_status) {
        if (tweet.retweeted_status.full_text) {
            result = tweet.retweeted_status.full_text;
        } else if (tweet.retweeted_status.extended_tweet) {
            result = tweet.retweeted_status.extended_tweet.full_text;
        } else {
            result = tweet.text;
        }
    } else {
        result = tweet.full_text || tweet.text;
    }

    return result;
}

Own implementation... This works for me