[TwitterBridge] Skip advertisment tweets (#1673)
This commit is contained in:
parent
d6f277d029
commit
6c244f4d9b
1 changed files with 16 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue