screenshots/{prime-gaming/{internal,external}, epic-games}
This commit is contained in:
parent
70b2b0d105
commit
584c80e939
2 changed files with 8 additions and 2 deletions
|
|
@ -93,7 +93,7 @@ for (let i = 1; i <= n; i++) {
|
||||||
console.log('Claimed successfully!');
|
console.log('Claimed successfully!');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
const p = path.resolve(dirs.screenshots, `${new Date().toISOString()}.png`);
|
const p = path.resolve(dirs.screenshots, 'epic-games', `${new Date().toISOString()}.png`);
|
||||||
await page.screenshot({ path: p, fullPage: true });
|
await page.screenshot({ path: p, fullPage: true });
|
||||||
console.info('Saved a screenshot of hcaptcha challenge to', p);
|
console.info('Saved a screenshot of hcaptcha challenge to', p);
|
||||||
console.error('Got hcaptcha challenge. To avoid it, get a link from https://www.hcaptcha.com/accessibility'); // TODO save this link in config and visit it daily to set accessibility cookie to avoid captcha challenge?
|
console.error('Got hcaptcha challenge. To avoid it, get a link from https://www.hcaptcha.com/accessibility'); // TODO save this link in config and visit it daily to set accessibility cookie to avoid captcha challenge?
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,10 @@ for (const card of games) {
|
||||||
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();
|
||||||
|
// const img = await (await card.$('img.tw-image')).getAttribute('src');
|
||||||
|
// console.log('Image:', img);
|
||||||
|
const p = path.resolve(dirs.screenshots, 'prime-gaming', 'internal', `${title.replace(/[^a-z0-9]/gi, '_')}.png`);
|
||||||
|
await card.screenshot({ path: p });
|
||||||
// await page.pause();
|
// await page.pause();
|
||||||
}
|
}
|
||||||
// claim games in linked stores. Origin: key, Epic Games Store: linked
|
// claim games in linked stores. Origin: key, Epic Games Store: linked
|
||||||
|
|
@ -84,7 +88,7 @@ for (const card of games) {
|
||||||
const store = store_text.toLowerCase().replace('full game for pc on ', '');
|
const store = store_text.toLowerCase().replace('full game for pc on ', '');
|
||||||
console.log('External store:', store);
|
console.log('External store:', store);
|
||||||
// save screenshot of potential code just in case
|
// save screenshot of potential code just in case
|
||||||
const p = path.resolve(dirs.screenshots, `${title.replace(/[^a-z0-9]/gi, '_')}.png`);
|
const p = path.resolve(dirs.screenshots, 'prime-gaming', 'external', `${title.replace(/[^a-z0-9]/gi, '_')}.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);
|
||||||
// print code if external store is not connected
|
// print code if external store is not connected
|
||||||
|
|
@ -102,5 +106,7 @@ for (const card of games) {
|
||||||
await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'});
|
await page.goto(URL_CLAIM, {waitUntil: 'domcontentloaded'});
|
||||||
await page.click('button[data-type="Game"]');
|
await page.click('button[data-type="Game"]');
|
||||||
} while (n);
|
} while (n);
|
||||||
|
const p = path.resolve(dirs.screenshots, 'prime-gaming', `${new Date().toISOString()}.png`);
|
||||||
|
await page.screenshot({ path: p, fullPage: true });
|
||||||
}
|
}
|
||||||
await context.close();
|
await context.close();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue