Reputation: 2853
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) "the short URL" ["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) { }
Upvotes: 0
Views: 78
Reputation:
The second Tweet is a retweet, so the urls are at
$tweetResult->retweeted_status->entities->urls
Upvotes: 1