epic-games: only save screenshot if none exists for game
This commit is contained in:
parent
3d41f4de5a
commit
e5ae4b6316
1 changed files with 3 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import { chromium } from 'playwright'; // stealth plugin needs no outdated playwright-extra
|
import { chromium } from 'playwright'; // stealth plugin needs no outdated playwright-extra
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { dirs, jsonDb, datetime, stealth, filenamify } from './util.js';
|
import { dirs, jsonDb, datetime, stealth, filenamify } from './util.js';
|
||||||
|
import { existsSync } from 'fs';
|
||||||
|
|
||||||
const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https://playwright.dev/docs/inspector
|
const debug = process.env.PWDEBUG == '1'; // runs non-headless and opens https://playwright.dev/docs/inspector
|
||||||
|
|
||||||
|
|
@ -84,7 +85,8 @@ try {
|
||||||
console.log('Current free game:', title);
|
console.log('Current free game:', title);
|
||||||
const title_url = page.url().split('/').pop();
|
const title_url = page.url().split('/').pop();
|
||||||
const p = path.resolve(dirs.screenshots, 'epic-games', `${title_url}.png`);
|
const p = path.resolve(dirs.screenshots, 'epic-games', `${title_url}.png`);
|
||||||
await page.screenshot({ path: p, fullPage: false }); // fullPage is quite long...
|
if (!existsSync(p)) await page.screenshot({ path: p, fullPage: false }); // fullPage is quite long...
|
||||||
|
continue;
|
||||||
if (btnText.toLowerCase() == 'in library') {
|
if (btnText.toLowerCase() == 'in library') {
|
||||||
console.log('Already in library! Nothing to claim.');
|
console.log('Already in library! Nothing to claim.');
|
||||||
} else { // GET
|
} else { // GET
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue