tweet_mode=extended 是否适用于 Twitter statuses/user_timeline API



没有提到 https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline.html tweet_mode

我想知道我是否使用了错误的 API 来利用tweet_mode?

在我的应用程序中,我提供了 tweet_mode=extended 参数,但它没有效果。 我的代码...

// Load the Tweets.
$args = array(
'screen_name' => $username,
'exclude_replies' => 'true',
'include_rts' => 'true',
'tweet_mode' => 'extended',
'count' => $numitems,
);
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$tweets = $connection->get('statuses/user_timeline', $args);
if (!empty($tweets)) {
foreach ($tweets as $tweet) {
$text = $tweet->full_text;
// etcetera

是的,您可以将tweet_mode与statuses/user_timeline API一起使用。 不过,转发是一个特例。 检查retweeted_status对象,如 https://dev.to/kehers/formatting-tweets-a-look-at-extended-tweets-retweets-and-quotes-n5j 中所述

简而言之,如果推文是转推,则必须以 $tweet->retweeted_status->full_text 访问扩展推文。 因此,有必要在代码中检查每个推文对象是否具有retweeted_status属性。

最新更新