How to get full text tweets with the codebird?

I want to use a twitter api to search tweets in P5,
and came across this codebird api

but the tweets returned are truncated, is there a way to get full text?
Thank you :slight_smile:

Hi,

Welcome to the community! :wink:

This issue is not really related to p5.js but here is the aswer :

Looks like the Twitter API changed and you need to use the tweet_mode to 'extended' in the search query :

var params = {
  q: "power",
  result_type: 'recent',
  count: 100,
  tweet_mode: 'extended'
};

And then the full text is obtained with :

let full_text;
if (tweet.retweeted_status) {
  full_text = tweet.retweeted_status.full_text;
} else {
  full_text = tweet.full_text;
}

(test if it has been retweeted otherwise get the full text)

Please also remember that it’s not recommended to put your API key public on internet since you can also post and modify data as stated here in the Codebird documentation :

:warning: Because the Consumer Key and Token Secret are available in the code, it is important that you configure your app as read-only at Twitter, unless you are sure to know what you are doing.

1 Like