From faf3a590a4a889c23ca31a25a557df22df56b123 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Tue, 28 Oct 2025 15:39:25 +0100 Subject: [PATCH] pg: gaming.amazon.com -> luna.amazon.com --- prime-gaming.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/prime-gaming.js b/prime-gaming.js index d1b8a43..7572c78 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -8,7 +8,8 @@ import { cfg } from './src/config.js'; const screenshot = (...a) => resolve(cfg.dir.screenshots, 'prime-gaming', ...a); // const URL_LOGIN = 'https://www.amazon.de/ap/signin'; // wrong. needs some session args to be valid? -const URL_CLAIM = 'https://gaming.amazon.com/home'; +const BASE_URL = 'https://luna.amazon.com'; +const URL_CLAIM = `${BASE_URL}/claims/home`; console.log(datetime(), 'started checking prime-gaming'); @@ -84,7 +85,7 @@ try { process.exit(1); } } - await page.waitForURL('https://gaming.amazon.com/home?signedIn=true'); + await page.waitForURL(`${BASE_URL}/claims/home?signedIn=true`); if (!cfg.debug) context.setDefaultTimeout(cfg.timeout); } user = await page.locator('[data-a-target="user-dropdown-first-name-text"]').first().innerText(); @@ -158,7 +159,7 @@ try { await card.scrollIntoViewIfNeeded(); const title = await (await card.locator('.item-card-details__body__primary')).innerText(); const slug = await (await card.locator('a')).getAttribute('href'); - const url = 'https://gaming.amazon.com' + slug.split('?')[0]; + const url = BASE_URL + slug.split('?')[0]; console.log('Current free game:', chalk.blue(title)); if (cfg.pg_timeLeft && await skipBasedOnTime(url)) continue; if (cfg.dryrun) continue; @@ -176,7 +177,7 @@ try { for (const card of external) { // need to get data incl. URLs in this loop and then navigate in another, otherwise .all() would update after coming back and .elementHandles() like above would lead to error due to page navigation: elementHandle.$: Protocol error (Page.adoptNode) const title = await card.locator('.item-card-details__body__primary').innerText(); const slug = await card.locator('a:has-text("Claim")').first().getAttribute('href'); - const url = 'https://gaming.amazon.com' + slug.split('?')[0]; + const url = BASE_URL + slug.split('?')[0]; // await (await card.$('text=Claim')).click(); // goes to URL of game, no need to wait external_info.push({ title, url }); } @@ -381,7 +382,7 @@ try { const dlcs = await Promise.all(cards.map(async card => ({ game: await card.locator('.item-card-details__body p').innerText(), title: await card.locator('.item-card-details__body__primary').innerText(), - url: 'https://gaming.amazon.com' + await card.locator('a').first().getAttribute('href'), + url: BASE_URL + await card.locator('a').first().getAttribute('href'), }))); // console.log(dlcs);