I’d like to know if anyone is able to retrieve full-text, non-truncated tweets using the Standard API.
Using npm twitter package to search tweets, I’m getting truncated tweets even when I set truncated: false. Below is a toy example of the data object of an individual tweet. As you can see, the text is truncated at the end and the missing text is replaced by this elipses ...
I’ve read the docs and googled extensively, and the commonly-recommended solutions don’t work for me. There are no tweet_mode: 'extended' or extended_tweet or retweeted_status or full_text anywhere in this data object, which is probably why nothing is return when I include these in the API call parameters.
Is this a limitation of the library, am I doing something wrong, or are full tweets only available in paid versions of the API? Because in this article the sample JSON from the Enterprise API (paid) does contain the data nodes required to retrieve full-text tweets.
My code is included below this data object. I’d like to know if anyone has a better solution, using any tool. Maybe I should try cURL. I haven’t figured out the full script yet, so I’m wondering if anyone has already done this before and can share.
{ statuses:
[ { created_at: 'Mon Jan 15 06:10:19 +0000 2018',
id: 952784997106139100,
id_str: '952784997106139137',
text: 'RT @amjoyshow: .@RepMaxineWaters on GOP colleagues: They cannot credibly come before the American public and defend #DonaldTrump. They’re a…',
truncated: false,
entities: [Object],
metadata: [Object],
source: '<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
in_reply_to_status_id: null,
in_reply_to_status_id_str: null,
in_reply_to_user_id: null,
in_reply_to_user_id_str: null,
in_reply_to_screen_name: null,
user: [Object],
geo: null,
coordinates: null,
place: null,
contributors: null,
retweeted_status: [Object],
is_quote_status: false,
retweet_count: 1195,
favorite_count: 0,
favorited: false,
retweeted: false,
lang: 'en' } ],
search_metadata:
{ completed_in: 0.019,
max_id: 952784997106139100,
max_id_str: '952784997106139137',
next_results: '?max_id=952784997106139136&q=%2523donaldtrump&geocode=40.7127837%2C-74.0059413%2C10mi&lang=en&count=1&include_entities=1&result_type=recent',
query: '%2523donaldtrump',
refresh_url: '?since_id=952784997106139137&q=%2523donaldtrump&geocode=40.7127837%2C-74.0059413%2C10mi&lang=en&result_type=recent&include_entities=1',
count: 1,
since_id: 0,
since_id_str: '0' } }
If you want to reproduce the results use this, though you’ll need to make a separate config.js file to hold your authentication keys:
const Twitter = require('twitter');
const config = require('./config.js'); // Separate file that contains the 4 authentication keys
const fs = require('fs');
var client = new Twitter(config);
var params = {
q: '%23donaldtrump', // Hashtag
geocode: '40.7127837,-74.0059413,10mi', // New York City
count: 1,
result_type: 'recent',
lang: 'en',
retweeted: false,
truncated: false,
retweeted_status:
{
truncated: false
}
}
client.get('search/tweets', params, (err, data) => {
if(err) throw err;
console.log(data);
});