mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 23:57:29 +02:00
[EpicGamesFreeBridge] productSlug can be null; also add a universal future-proof-ish fallback (#4595)
* productSlug can be null, do more discovery, add fallback * productSlug can be garbage too, remove it completely
This commit is contained in:
@@ -59,13 +59,20 @@ class EpicGamesFreeBridge extends BridgeAbstract
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
$slug = $element['catalogNs']['mappings'][0]['pageSlug'] ?? null;
|
||||
if ($slug !== null) {
|
||||
$uri = parent::getURI() . $this->getInput('locale') . '/p/' . $slug;
|
||||
} else {
|
||||
// slug not found, show the root promos page
|
||||
$uri = parent::getURI() . $this->getInput('locale') . '/free-games';
|
||||
}
|
||||
$item = [
|
||||
'author' => $element['seller']['name'],
|
||||
'content' => $element['description'],
|
||||
'enclosures' => array_map(fn($item) => $item['url'], $element['keyImages']),
|
||||
'timestamp' => strtotime($promo['startDate']),
|
||||
'title' => $element['title'],
|
||||
'uri' => parent::getURI() . $this->getInput('locale') . '/p/' . $element['productSlug'],
|
||||
'uri' => $uri,
|
||||
];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
|
Reference in New Issue
Block a user