pg: also get and store url for internal games
This commit is contained in:
parent
fc810af80e
commit
e4e4ce703d
1 changed files with 4 additions and 2 deletions
|
|
@ -112,12 +112,14 @@ try {
|
||||||
for (const card of internal) {
|
for (const card of internal) {
|
||||||
await card.scrollIntoViewIfNeeded();
|
await card.scrollIntoViewIfNeeded();
|
||||||
const title = await (await card.$('.item-card-details__body__primary')).innerText();
|
const title = await (await card.$('.item-card-details__body__primary')).innerText();
|
||||||
|
const slug = await (await card.$('a')).getAttribute('href');
|
||||||
|
const url = 'https://gaming.amazon.com' + slug.split('?')[0];
|
||||||
console.log('Current free game:', title);
|
console.log('Current free game:', title);
|
||||||
if (cfg.dryrun) continue;
|
if (cfg.dryrun) continue;
|
||||||
if (cfg.interactive && !await confirm()) continue;
|
if (cfg.interactive && !await confirm()) continue;
|
||||||
await (await card.$('.tw-button:has-text("Claim")')).click();
|
await (await card.$('.tw-button:has-text("Claim")')).click();
|
||||||
db.data[user][title] ||= { title, time: datetime(), store: 'internal' };
|
db.data[user][title] ||= { title, time: datetime(), url, store: 'internal' };
|
||||||
notify_games.push({ title, status: 'claimed', url: URL_CLAIM });
|
notify_games.push({ title, status: 'claimed', url });
|
||||||
// const img = await (await card.$('img.tw-image')).getAttribute('src');
|
// const img = await (await card.$('img.tw-image')).getAttribute('src');
|
||||||
// console.log('Image:', img);
|
// console.log('Image:', img);
|
||||||
await card.screenshot({ path: screenshot('internal', `${filenamify(title)}.png`) });
|
await card.screenshot({ path: screenshot('internal', `${filenamify(title)}.png`) });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue