From 2e08c41933f72ca87ea25b198aaeac546ca6bdae Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Wed, 2 Feb 2022 13:53:34 +0100 Subject: [PATCH] prime-gaming: clearer log of number of (un)claimed games --- prime-gaming.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prime-gaming.js b/prime-gaming.js index ad8a95a..f24829c 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -71,11 +71,11 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s if (!debug) context.setDefaultTimeout(TIMEOUT); } console.log('Signed in.'); - const game_sel = 'div[data-a-target="offer-list-FGWP_FULL"] .offer__action:has-text("Claim game")'; await page.waitForSelector('div[data-a-target="offer-list-FGWP_FULL"]'); + console.log('Number of already claimed games (total):', await page.locator('div[data-a-target="offer-list-FGWP_FULL"] p:has-text("Claimed")').count()); + const game_sel = 'div[data-a-target="offer-list-FGWP_FULL"] .offer__action:has-text("Claim game")'; const n = await page.locator(game_sel).count(); - console.log('Number of free unclaimed games:', n); - console.log('Number of already claimed games:', await page.locator('div[data-a-target="offer-list-FGWP_FULL"] p:has-text("Claimed")').count()); + console.log('Number of free unclaimed games (Prime Gaming):', n); const games = await page.$$(game_sel); // for (let i=1; i<=n; i++) { for (const card of games) { @@ -91,7 +91,7 @@ const TIMEOUT = 20 * 1000; // 20s, default is 30s const game_sel = 'div[data-a-target="offer-list-FGWP_FULL"] .offer__action:has(p:text-is("Claim"))'; do { let n = await page.locator(game_sel).count(); - console.log('Number of free unclaimed games in external stores:', n); + console.log('Number of free unclaimed games (external stores):', n); const card = await page.$(game_sel); if (!card) break; const title = await (await card.$('h3')).innerText();