Skip to content

Commit

Permalink
eg: e.offerMappings is [] for Death Stranding, instead `e.product…
Browse files Browse the repository at this point in the history
…Slug` fits
  • Loading branch information
vogler committed May 25, 2023
1 parent 1d1f95d commit 4e8e8ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion epic-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ handleSIGINT();
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // otherwise got UNABLE_TO_GET_ISSUER_CERT_LOCALLY
const promoJson = await (await fetch(`https://store-site-backend-static.ak.epicgames.com/freeGamesPromotions?country=${cfg.eg_country}`)).json(); // ?locale=en-US
const currentGames = promoJson.data.Catalog.searchStore.elements.filter(e => e.promotions?.promotionalOffers?.length);
const gameURL = e => `https://store.epicgames.com/p/${e.offerMappings[0].pageSlug}`; // e.urlSlug may be wrong and lead to 404, e.catalogNs.mappings[0].pageSlug leads to base game for add-ons!
const gameURL = e => `https://store.epicgames.com/p/${e.productSlug || e.offerMappings[0].pageSlug}`; // e.urlSlug may be wrong and lead to 404, e.catalogNs.mappings[0].pageSlug leads to base game for add-ons!
console.log('Free games:', currentGames.map(e => `${e.title} - ${gameURL(e)}`));

// TODO check if there are new games to claim before launching browser? https://github.com/vogler/free-games-claimer/issues/29
Expand Down

0 comments on commit 4e8e8ee

Please sign in to comment.