Skip to content

Commit faf3a59

Browse files
committed
pg: gaming.amazon.com -> luna.amazon.com
1 parent f7e4d05 commit faf3a59

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

prime-gaming.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { cfg } from './src/config.js';
88
const screenshot = (...a) => resolve(cfg.dir.screenshots, 'prime-gaming', ...a);
99

1010
// const URL_LOGIN = 'https://www.amazon.de/ap/signin'; // wrong. needs some session args to be valid?
11-
const URL_CLAIM = 'https://gaming.amazon.com/home';
11+
const BASE_URL = 'https://luna.amazon.com';
12+
const URL_CLAIM = `${BASE_URL}/claims/home`;
1213

1314
console.log(datetime(), 'started checking prime-gaming');
1415

@@ -84,7 +85,7 @@ try {
8485
process.exit(1);
8586
}
8687
}
87-
await page.waitForURL('https://gaming.amazon.com/home?signedIn=true');
88+
await page.waitForURL(`${BASE_URL}/claims/home?signedIn=true`);
8889
if (!cfg.debug) context.setDefaultTimeout(cfg.timeout);
8990
}
9091
user = await page.locator('[data-a-target="user-dropdown-first-name-text"]').first().innerText();
@@ -158,7 +159,7 @@ try {
158159
await card.scrollIntoViewIfNeeded();
159160
const title = await (await card.locator('.item-card-details__body__primary')).innerText();
160161
const slug = await (await card.locator('a')).getAttribute('href');
161-
const url = 'https://gaming.amazon.com' + slug.split('?')[0];
162+
const url = BASE_URL + slug.split('?')[0];
162163
console.log('Current free game:', chalk.blue(title));
163164
if (cfg.pg_timeLeft && await skipBasedOnTime(url)) continue;
164165
if (cfg.dryrun) continue;
@@ -176,7 +177,7 @@ try {
176177
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)
177178
const title = await card.locator('.item-card-details__body__primary').innerText();
178179
const slug = await card.locator('a:has-text("Claim")').first().getAttribute('href');
179-
const url = 'https://gaming.amazon.com' + slug.split('?')[0];
180+
const url = BASE_URL + slug.split('?')[0];
180181
// await (await card.$('text=Claim')).click(); // goes to URL of game, no need to wait
181182
external_info.push({ title, url });
182183
}
@@ -381,7 +382,7 @@ try {
381382
const dlcs = await Promise.all(cards.map(async card => ({
382383
game: await card.locator('.item-card-details__body p').innerText(),
383384
title: await card.locator('.item-card-details__body__primary').innerText(),
384-
url: 'https://gaming.amazon.com' + await card.locator('a').first().getAttribute('href'),
385+
url: BASE_URL + await card.locator('a').first().getAttribute('href'),
385386
})));
386387
// console.log(dlcs);
387388

0 commit comments

Comments
 (0)