From 5a40446a96127db5a2e748cbb20a4177541e6c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B9=E3=83=84=E3=82=BC=E3=83=AB?= Date: Fri, 6 Jan 2023 10:06:09 +0200 Subject: [PATCH] Update 'run.php' --- run.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 = [];