Example result running on a friend's library, who's been actively collecting Epic free games of the Week since 2020:
I load the Epic Games | Transactions page and notice that you can click each block to reveal that info (triggers a network call) :
Once clicked and loaded the page contains this data:
I notice in my browser the class given to the <td>
holding the list price data is ".am-1c0kwh0"
:
If you see a different class (it's likely randomized, maybe at each site build deploy), change that part of the code ;)
You can then run my script. In a compressed nutshell I run in my console:
count=0;sum=0.0;$.find(".am-1c0kwh0").filter((e) => !e.innerText.startsWith("+")).forEach(e => {count++;let text=e.innerText.replace("€", "").trim();sum += 1 + parseInt(text);}); console.log("Total", count, "games, purchase value:", sum, "euros!");(sum > 2500) ? ":O" : ":)";
This results in an output similar to
> Total 220 games, purchase value: 4712 euros!
":O"
Here's a verbose version of the above, so that you can adjust my local assumptions for eventual language/currency differences:
var count=0; // To sum how many games we analyze
var sum=0.0; // To sum how much games cost
let selector = ".am-1c0kwh0"; // Class observed in my browser inspector on the <td> holding the price data
$.find(selector).filter((e) => !e.innerText.startsWith("+")).forEach(e => {
// The above filter to remove some "Epic Rewards" line on a purchase which broke the addition
count++;
let text=e.innerText.replace("€", "").trim(); // Remove the chars which prevent parsing the price as Number
console.log(`Adding ${text} to ${sum}...`);
sum += 1 + parseInt(text); // So a game listed at 19.99 euros gets rounded to 1 + 19 = 20 euros
});
console.log("Total", count, "jeux, à l'achat :", sum, "euros !");
(sum > 2500) ? ":O" : ":)"; // Return value because if each console run returns one, then why look so undefined
- The code could be made more generic by finding which
<td>
holds a price text, then using its class? Left as an exercise for the reader - Excluding that one game you paid, or deducing its cost, could be meaningful to someone else than me
- Maybe we can do without clicking 200 games one by one first, waiting on a blocked UI between two instances of visual feedback. You may automate a
click
event on all these? I personally found it fun to do. If you like idle games this might be your jam too, you're welcome