diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 7b7bbe86..114b2feb 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -210,6 +210,17 @@ EOD $hidePictures = $this->getInput('nopic'); + $promotedTweetIds = array_reduce($data->timeline->instructions[0]->addEntries->entries, function($carry, $entry) { + if (!isset($entry->content->item)) { + return $carry; + } + $tweet = $entry->content->item->content->tweet; + if (isset($tweet->promotedMetadata)) { + $carry[] = $tweet->id; + } + return $carry; + }, array()); + foreach($data->globalObjects->tweets as $tweet) { /* Debug::log('>>> ' . json_encode($tweet)); */ @@ -218,6 +229,11 @@ EOD continue; } + // Skip promoted tweets + if (in_array($tweet->id_str, $promotedTweetIds)) { + continue; + } + $item = array(); // extract username and sanitize $user_info = $this->getUserInformation($tweet->user_id_str, $data->globalObjects);