1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-05 08:07:33 +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:
Anton Smirnov
2025-08-04 00:59:42 +03:00
committed by GitHub
parent c90b98b965
commit 2ca696c1cf

View File

@@ -59,13 +59,20 @@ class EpicGamesFreeBridge extends BridgeAbstract
) { ) {
continue; 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 = [ $item = [
'author' => $element['seller']['name'], 'author' => $element['seller']['name'],
'content' => $element['description'], 'content' => $element['description'],
'enclosures' => array_map(fn($item) => $item['url'], $element['keyImages']), 'enclosures' => array_map(fn($item) => $item['url'], $element['keyImages']),
'timestamp' => strtotime($promo['startDate']), 'timestamp' => strtotime($promo['startDate']),
'title' => $element['title'], 'title' => $element['title'],
'uri' => parent::getURI() . $this->getInput('locale') . '/p/' . $element['productSlug'], 'uri' => $uri,
]; ];
$this->items[] = $item; $this->items[] = $item;
} }