mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-03-14 20:21:14 +03:00
parent
321ec7c8c1
commit
192fc0ee9b
1 changed files with 17 additions and 1 deletions
|
@ -41,16 +41,32 @@ TEXT;
|
|||
$this->getInput('feed_4'),
|
||||
$this->getInput('feed_5'),
|
||||
];
|
||||
|
||||
// Remove empty values
|
||||
$feeds = array_filter($feeds);
|
||||
|
||||
foreach ($feeds as $feed) {
|
||||
// Fetch all items from the feed
|
||||
$this->collectExpandableDatas($feed);
|
||||
}
|
||||
|
||||
// Sort by timestamp descending
|
||||
usort($this->items, fn($a, $b) => $b['timestamp'] <=> $a['timestamp']);
|
||||
|
||||
// Remove duplicates
|
||||
$items = [];
|
||||
foreach ($this->items as $item) {
|
||||
$index = $item['uri'] ?? null;
|
||||
if ($index) {
|
||||
// Overwrite duplicates
|
||||
$items[$index] = $item;
|
||||
} else {
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Grab the first $limit items
|
||||
$this->items = array_slice($this->items, 0, $limit);
|
||||
$this->items = array_slice(array_values($items), 0, $limit);
|
||||
}
|
||||
|
||||
public function getIcon()
|
||||
|
|
Loading…
Add table
Reference in a new issue