include URL to game in .json

This commit is contained in:
Ralf Vogler 2022-07-14 17:12:15 +02:00
parent 4868ba66f9
commit f770ef5580
2 changed files with 3 additions and 3 deletions

View file

@ -104,7 +104,7 @@ try {
// } // }
// await page.waitForTimeout(3000); // await page.waitForTimeout(3000);
await page.waitForSelector('text=Thank you for buying'); // EU: wait, non-EU: wait again 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++; run.c++;
console.log('Claimed successfully!'); console.log('Claimed successfully!');
} catch (e) { } catch (e) {

View file

@ -76,7 +76,7 @@ try {
const title = await (await card.$('.item-card-details__body__primary')).innerText(); const title = await (await card.$('.item-card-details__body__primary')).innerText();
console.log('Current free game:', title); console.log('Current free game:', title);
await (await card.$('button:has-text("Claim game")')).click(); 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++; run.c_internal++;
// const img = await (await card.$('img.tw-image')).getAttribute('src'); // const img = await (await card.$('img.tw-image')).getAttribute('src');
// console.log('Image:', img); // console.log('Image:', img);
@ -121,7 +121,7 @@ try {
} }
console.log('URL to redeem game:', redeem[store]); 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 // save screenshot of potential code just in case
const p = path.resolve(dirs.screenshots, 'prime-gaming', 'external', `${sanitizeFilename(title)}.png`); const p = path.resolve(dirs.screenshots, 'prime-gaming', 'external', `${sanitizeFilename(title)}.png`);
await page.screenshot({ path: p, fullPage: true }); await page.screenshot({ path: p, fullPage: true });