pg: indent logging per game
This commit is contained in:
parent
569e690d9e
commit
7ffdd61c44
1 changed files with 5 additions and 5 deletions
|
|
@ -102,9 +102,9 @@ try {
|
||||||
// Full game for PC [and MAC] on: gog.com, Origin, Legacy Games, EPIC GAMES, Battle.net
|
// Full game for PC [and MAC] on: gog.com, Origin, Legacy Games, EPIC GAMES, Battle.net
|
||||||
// 3 Full PC Games on Legacy Games
|
// 3 Full PC Games on Legacy Games
|
||||||
const store = store_text.toLowerCase().replace(/.* on /, '');
|
const store = store_text.toLowerCase().replace(/.* on /, '');
|
||||||
console.log('External store:', store);
|
console.log(' External store:', store);
|
||||||
if (await page.locator('div:has-text("Link game account")').count()) {
|
if (await page.locator('div:has-text("Link game account")').count()) {
|
||||||
console.error('Account linking is required to claim this offer!');
|
console.error(' Account linking is required to claim this offer!');
|
||||||
} else {
|
} else {
|
||||||
// print code if there is one
|
// print code if there is one
|
||||||
const redeem = {
|
const redeem = {
|
||||||
|
|
@ -115,17 +115,17 @@ try {
|
||||||
let code;
|
let code;
|
||||||
if (store in redeem) { // did not work for linked origin: && !await page.locator('div:has-text("Successfully Claimed")').count()
|
if (store in redeem) { // did not work for linked origin: && !await page.locator('div:has-text("Successfully Claimed")').count()
|
||||||
code = await page.inputValue('input[type="text"]');
|
code = await page.inputValue('input[type="text"]');
|
||||||
console.log('Code to redeem game:', code);
|
console.log(' Code to redeem game:', code);
|
||||||
if (store == 'legacy games') { // may be different URL like https://legacygames.com/primeday/puzzleoftheyear/
|
if (store == 'legacy games') { // may be different URL like https://legacygames.com/primeday/puzzleoftheyear/
|
||||||
redeem[store] = await (await page.$('li:has-text("Click here") a')).getAttribute('href');
|
redeem[store] = await (await page.$('li:has-text("Click here") a')).getAttribute('href');
|
||||||
}
|
}
|
||||||
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, url: page.url() });
|
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', `${filenamify(title)}.png`);
|
const p = path.resolve(dirs.screenshots, 'prime-gaming', 'external', `${filenamify(title)}.png`);
|
||||||
await page.screenshot({ path: p, fullPage: true });
|
await page.screenshot({ path: p, fullPage: true });
|
||||||
console.info('Saved a screenshot of page to', p);
|
// console.info(' Saved a screenshot of page to', p);
|
||||||
run.c_external++;
|
run.c_external++;
|
||||||
}
|
}
|
||||||
// await page.pause();
|
// await page.pause();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue