Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Revadike committed Feb 6, 2020
1 parent 0e3a110 commit 011d399
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# EpicGames Freebies Claimer

## Description
Claim available free game promotions from the Epic Game Store.

## Instructions
1. Download/clone repo
2. Edit `index.js` to include your EpicGames credentials
2. Run `npm install`
3. Run `node index.js`
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { Launcher } = require(`epicgames-client`);

const epic = new Launcher({
email: `YOUR_EMAIL_HERE`,
password: `YOUR_PASSWORD_HERE`
});

(async () => {
if(!await epic.init() || !await epic.login()) {
throw new Error(`Error while initialize or login process.`);
}

console.log(`Logged in as ${epic.account.name} (${epic.account.id})`);

let all = await epic.getOffersForNamespace(`epic`, 1000, 0);
let freegames = all.elements.filter(game => game.categories.find(cat => cat.path === `freegames`));
for (let game of freegames) {
let namespace = game.customAttributes[`com.epicgames.app.offerNs`].value
if (!namespace) {
continue;
}

let offers = await epic.getOffersForNamespace(namespace, 100, 0);
let offer = offers.elements.find(game => game.currentPrice === 0 && game.discountPercentage === 0);
let purchased = await epic.purchase(offer, 1).catch(console.error);
if (purchased) {
console.log(`Successfully redeemed ${offer.title} (${purchased})`);
}
}
})();
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "epicgames-freebies-claimer",
"description": "Claim free game promotions from the Epic Game Store",
"version": "1.0.0",
"author": "Revadike",
"homepage": "https://revadike.com",
"url": "https://github.com/revadike/epicgames-freebies-claimer",
"license": "MIT",
"main": "index.js",
"dependencies": {
"epicgames-client": "latest"
}
}

0 comments on commit 011d399

Please sign in to comment.