Fix gog error per @jordyamc
https://github.com/vogler/free-games-claimer/issues/398#issuecomment-2487274414
This commit is contained in:
parent
c8cf7362fa
commit
d5072a62c0
1 changed files with 2 additions and 1 deletions
3
gog.js
3
gog.js
|
|
@ -99,7 +99,8 @@ try {
|
||||||
console.log('Currently no free giveaway!');
|
console.log('Currently no free giveaway!');
|
||||||
} else {
|
} else {
|
||||||
const text = await page.locator('.giveaway__content-header').innerText();
|
const text = await page.locator('.giveaway__content-header').innerText();
|
||||||
const title = text.match(/Claim (.*) and don't miss the/)[1];
|
const match_all = text.match(/Claim (.*) and don't miss the|Success! (.*) was added to/);
|
||||||
|
const title = match_all[1] ? match_all[1] : match_all[2];
|
||||||
const url = await banner.locator('a').first().getAttribute('href');
|
const url = await banner.locator('a').first().getAttribute('href');
|
||||||
console.log(`Current free game: ${title} - ${url}`);
|
console.log(`Current free game: ${title} - ${url}`);
|
||||||
db.data[user][title] ||= { title, time: datetime(), url };
|
db.data[user][title] ||= { title, time: datetime(), url };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue