diff --git a/run.php b/run.php index a9efb7e..39f07bb 100644 --- a/run.php +++ b/run.php @@ -58,7 +58,19 @@ foreach ($elements as $el) { 'promo_end_date' => $promotion['endDate'], ]; - $game_url = "https://www.epicgames.com/store/en-US/p/{$el['productSlug']}"; + // Get page slug + $page_slug = $el['productSlug']; + if (empty($page_slug)) { + foreach ($el['catalogNs']['mappings'] as $row) { + if (isset($row['pageSlug'])) { + $page_slug = $row['pageSlug']; + break; + } + } + } + + // Build page url + $game_url = "https://www.epicgames.com/store/en-US/p/{$page_slug}"; // Send telegram notification $tg_msg_arr = [];