Cannot retrieving the expanded_url
Cannot get the expanded_url from this tweet -> https://twitter.com/i/web/status/1297715123360915457, but it works fine here -> https://twitter.com/i/web/status/1298033841374822400
I'm using abraham/twitteroauth version 1.2.0, also tried on 1.1.0 and 2.0.1. Still not retrieving the expanded_url.
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth(
TW_KEY,
TW_SECRET,
TW_TOKEN,
TW_TOKEN_SECRET
);
$tweetResult = $connection->get(
"statuses/show",
[
'id' => '1298033841374822400', "tweet_mode" => "extended"
//'id' => '1297715123360915457', "tweet_mode" => "extended"
]
);
var_dump($tweetResult->entities->urls);
result for 1298033841374822400:
array(1) {
[0]=>
object(stdClass)#11 (4) {
["url"]=>
string(23) "https://t.co/BW2nTCH1yX"
["expanded_url"]=>
string(53) "https://contest.mdpr.jp/mrcon202003/gal/taiki06191148"
["display_url"]=>
string(33) "contest.mdpr.jp/mrcon202003/ga…"
["indices"]=>
array(2) {
[0]=>
int(67)
[1]=>
int(90)
}
}
}
and result for 1297715123360915457
array(0) {
}
1297715123360915457 is a retweet and does not include any URLs itself. If you look at $tweetResult->retweeted_status->entities->urls you should get the results you want.