Ruben
Ruben

Reputation: 121

Twitter API not responding with whole tweet

I am creating a Twitter API but the API isn't returning the whole tweet, it seems to stop when their is a link in the tweet. I am using PHP with TwitterAPIExchange.php, how can I fix this?

Example:

Ingewikkelde antwoorden op vragen van @AgnesMulderCDA over de #waakvlam van de #NAM. De NAM hoeft pas in november t… https:// t.co/ZM0Tuk9AYv

Should be this: https://twitter.com/SGaster/status/849334531907887104

$url = 'https://api.twitter.com/1.1/search/tweets.json';
$getfield = '?q=#kamerwatch';
$requestMethod = 'GET';

$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();

$print = (json_decode($response));
print_r($print);

Upvotes: 2

Views: 2796

Answers (1)

remy boys
remy boys

Reputation: 2948

add tweet_mode=extended on your request

example :

previous url : https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=booty&count=50

correct url : https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=booty&count=50&tweet_mode=extended

and for getting the text use full_text instead of text key.

more detail here --> https://twittercommunity.com/t/truncated-text-and-media-entities-not-returned/74358

Upvotes: 7

Related Questions