AgentTechnoman 2024-12-19 16:46:18 -07:00 committed by GitHub
parent c8cf7362fa
commit d5072a62c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

3
gog.js
View file

@ -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 };