pg: gaming.amazon.com -> luna.amazon.com
This commit is contained in:
parent
f7e4d05804
commit
faf3a590a4
1 changed files with 6 additions and 5 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue