From d5072a62c090ab637af98da524f0a37268f25638 Mon Sep 17 00:00:00 2001 From: AgentTechnoman <46273498+AgentTechnoman@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:46:18 -0700 Subject: [PATCH] Fix gog error per @jordyamc https://github.com/vogler/free-games-claimer/issues/398#issuecomment-2487274414 --- gog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gog.js b/gog.js index 0688626..c4d5078 100644 --- a/gog.js +++ b/gog.js @@ -99,7 +99,8 @@ try { console.log('Currently no free giveaway!'); } else { const text = await page.locator('.giveaway__content-header').innerText(); - const title = text.match(/Claim (.*) and don't miss the/)[1]; + const match_all = text.match(/Claim (.*) and don't miss the|Success! (.*) was added to/); + const title = match_all[1] ? match_all[1] : match_all[2]; const url = await banner.locator('a').first().getAttribute('href'); console.log(`Current free game: ${title} - ${url}`); db.data[user][title] ||= { title, time: datetime(), url };