From f770ef55800e5a4e7017a5aadef854ed11365540 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Thu, 14 Jul 2022 17:12:15 +0200 Subject: [PATCH] include URL to game in .json --- epic-games.js | 2 +- prime-gaming.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epic-games.js b/epic-games.js index 4470e71..4ef1b47 100644 --- a/epic-games.js +++ b/epic-games.js @@ -104,7 +104,7 @@ try { // } // await page.waitForTimeout(3000); await page.waitForSelector('text=Thank you for buying'); // EU: wait, non-EU: wait again - db.data.claimed.push({title, time: datetime()}); + db.data.claimed.push({ title, time: datetime(), url: page.url() }); run.c++; console.log('Claimed successfully!'); } catch (e) { diff --git a/prime-gaming.js b/prime-gaming.js index 79e95cf..0bb4196 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -76,7 +76,7 @@ try { const title = await (await card.$('.item-card-details__body__primary')).innerText(); console.log('Current free game:', title); await (await card.$('button:has-text("Claim game")')).click(); - db.data.claimed.push({title, time: datetime(), store: 'internal'}); + db.data.claimed.push({ title, time: datetime(), store: 'internal' }); run.c_internal++; // const img = await (await card.$('img.tw-image')).getAttribute('src'); // console.log('Image:', img); @@ -121,7 +121,7 @@ try { } console.log('URL to redeem game:', redeem[store]); } - db.data.claimed.push({title, time: datetime(), store, code}); + db.data.claimed.push({ title, time: datetime(), store, code, url: page.url() }); // save screenshot of potential code just in case const p = path.resolve(dirs.screenshots, 'prime-gaming', 'external', `${sanitizeFilename(title)}.png`); await page.screenshot({ path: p, fullPage: true });