-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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})`); | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |