Skip to content

Commit 292aada

Browse files
committed
eg: list games included in a bundle
1 parent 7279ba0 commit 292aada

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

epic-games.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,22 @@ try {
176176
}
177177

178178
let title;
179+
let bundle_includes;
179180
if (await page.locator('span:text-is("About Bundle")').count()) {
180-
// console.log(' This is a bundle containing: TODO');
181181
title = (await page.locator('span:has-text("Buy"):left-of([data-testid="purchase-cta-button"])').first().innerText()).replace('Buy ', '');
182182
// h1 first didn't exist for bundles but now it does... However h1 would e.g. be 'Fallout® Classic Collection' instead of 'Fallout Classic Collection'
183+
try {
184+
bundle_includes = await Promise.all((await page.locator('.product-card-top-row h5').all()).map(b => b.innerText()));
185+
} catch (e) {
186+
console.error('Failed to get "Bundle Includes":', e);
187+
}
183188
} else {
184189
title = await page.locator('h1').first().innerText();
185190
}
186191
const game_id = page.url().split('/').pop();
187192
db.data[user][game_id] ||= { title, time: datetime(), url: page.url() }; // this will be set on the initial run only!
188193
console.log('Current free game:', title);
194+
if (bundle_includes) console.log(' This bundle includes:', bundle_includes);
189195
const notify_game = { title, url, status: 'failed' };
190196
notify_games.push(notify_game); // status is updated below
191197

@@ -220,7 +226,7 @@ try {
220226
console.log(' Accept End User License Agreement (only needed once)');
221227
console.log(page.innerHTML);
222228
console.log('Please report the HTML above here: https://github.com/vogler/free-games-claimer/issues/371');
223-
await page.locator('input#agree').check(); // TODO Bundle: got stuck here
229+
await page.locator('input#agree').check(); // TODO Bundle: got stuck here; likely unrelated to bundle and locator just changed: https://github.com/vogler/free-games-claimer/issues/371
224230
await page.locator('button:has-text("Accept")').click();
225231
}).catch(_ => { });
226232

0 commit comments

Comments
 (0)