indent prime-gaming

This commit is contained in:
Ralf Vogler 2022-07-13 15:57:04 +02:00
parent 18de5fdfa8
commit 02a49a5a19

View file

@ -84,15 +84,14 @@ for (const card of games) {
await card.screenshot({ path: p });
// await page.pause();
}
// claim games in linked stores. Origin: key, Epic Games Store: linked
{
// claim games in external/linked stores. Linked: origin.com, epicgames.com; Redeem-key: gog.com, legacygames.com
let n;
const game_sel = `${games_sel} [data-a-target="item-card"]:has(p:text-is("Claim"))`;
const game_sel_ext = `${games_sel} [data-a-target="item-card"]:has(p:text-is("Claim"))`;
do {
n = await page.locator(game_sel).count();
n = await page.locator(game_sel_ext).count();
run.n_external ||= n;
console.log('Number of free unclaimed games (external stores):', n);
const card = await page.$(game_sel);
const card = await page.$(game_sel_ext);
if (!card) break;
const title = await (await card.$('.item-card-details__body__primary')).innerText();
console.log('Current free game:', title);
@ -135,7 +134,6 @@ for (const card of games) {
} while (n);
const p = path.resolve(dirs.screenshots, 'prime-gaming', `${datetime()}.png`);
await page.screenshot({ path: p, fullPage: true });
}
} catch(error) {
console.error(error);
run.error = error.toString();