eg: fix title for Bundles, TODO got stuck after
happened for 'LISA: The Definitive Edition' - https://store.epicgames.com/en-US/bundles/lisa-the-definitive-edition
This commit is contained in:
parent
6f06fccd46
commit
3338d08a1d
1 changed files with 10 additions and 4 deletions
|
|
@ -159,7 +159,13 @@ try {
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = await page.locator('h1').first().innerText();
|
let title;
|
||||||
|
if (await page.locator('span:text-is("About Bundle")').count()) {
|
||||||
|
// console.log(' This is a bundle containing: TODO');
|
||||||
|
title = (await page.locator('span:has-text("Buy"):left-of([data-testid="purchase-cta-button"])').first().innerText()).replace('Buy ', '');
|
||||||
|
} else {
|
||||||
|
title = await page.locator('h1').first().innerText();
|
||||||
|
}
|
||||||
const game_id = page.url().split('/').pop();
|
const game_id = page.url().split('/').pop();
|
||||||
db.data[user][game_id] ||= { title, time: datetime(), url: page.url() }; // this will be set on the initial run only!
|
db.data[user][game_id] ||= { title, time: datetime(), url: page.url() }; // this will be set on the initial run only!
|
||||||
console.log('Current free game:', title);
|
console.log('Current free game:', title);
|
||||||
|
|
@ -192,7 +198,7 @@ try {
|
||||||
// Accept End User License Agreement (only needed once)
|
// Accept End User License Agreement (only needed once)
|
||||||
page.locator('input#agree').waitFor().then(async () => {
|
page.locator('input#agree').waitFor().then(async () => {
|
||||||
console.log(' Accept End User License Agreement (only needed once)');
|
console.log(' Accept End User License Agreement (only needed once)');
|
||||||
await page.locator('input#agree').check();
|
await page.locator('input#agree').check(); // TODO Bundle: got stuck here
|
||||||
await page.locator('button:has-text("Accept")').click();
|
await page.locator('button:has-text("Accept")').click();
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
|
|
||||||
|
|
@ -243,7 +249,7 @@ try {
|
||||||
// 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?
|
||||||
}).catch(_ => { }); // may time out if not shown
|
}).catch(_ => { }); // may time out if not shown
|
||||||
await page.locator('text=Thanks for your order!').waitFor({ state: 'attached' });
|
await page.locator('text=Thanks for your order!').waitFor({ state: 'attached' }); // TODO Bundle: got stuck here
|
||||||
db.data[user][game_id].status = 'claimed';
|
db.data[user][game_id].status = 'claimed';
|
||||||
db.data[user][game_id].time = datetime(); // claimed time overwrites failed/dryrun time
|
db.data[user][game_id].time = datetime(); // claimed time overwrites failed/dryrun time
|
||||||
console.log(' Claimed successfully!');
|
console.log(' Claimed successfully!');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue