From cf59da5d9e74d49d684762625ae2446341115336 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Sun, 23 Jun 2024 18:02:02 +0200 Subject: [PATCH] gog: new locators, fixes #326, #334 --- gog.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gog.js b/gog.js index 651afa6..de5d02f 100644 --- a/gog.js +++ b/gog.js @@ -93,10 +93,9 @@ try { if (!await banner.count()) { console.log('Currently no free giveaway!'); } else { - const text = await page.locator('.giveaway-banner__title').innerText(); - const title = text.match(/Claim (.*)/)[1]; - const slug = await banner.getAttribute('href'); - const url = `https://gog.com${slug}`; + const text = await page.locator('.giveaway__content-header').innerText(); + const title = text.match(/Claim (.*) and don't miss the/)[1]; + const url = await banner.locator('a').first().getAttribute('href'); console.log(`Current free game: ${title} - ${url}`); db.data[user][title] ||= { title, time: datetime(), url }; if (cfg.dryrun) process.exit(1);