/free-games-claimer

Claims free games on the Epic Games Store and Amazon Prime Gaming.

Primary LanguageJavaScript

free-games-claimer

Claims free games periodically on

Pull requests welcome :)

Works on Windows/macOS/Linux.

Setup

Install Docker and use

docker run --rm -it -p 6080:6080 -v fgc:/fgc/data ghcr.io/vogler/free-games-claimer

which will run node epic-games; node prime-gaming. If you only want to claim games for one store, you can override the default by appending e.g. node epic-games at the end of the docker run command. Data is stored in the volume fgc.

I want to run without Docker or develop locally.
  1. Install Node.js
  2. Clone/download this repository and cd into it in a terminal
  3. Run npm install && npx playwright install firefox

This downloads Firefox to a cache in home (doc). If you are missing some dependencies for the browser on your system, you can use sudo npx playwright install firefox --with-deps.

Usage

Both scripts start an automated Firefox instance, either with the browser GUI shown or hidden (headless mode).

Login has to be done in the browser. It's hard to automate since you usually need to enter some OTP (but you can select 'remember this device'). After login, the script will just continue, but you can also restart it.

If something goes wrong, use PWDEBUG=1 node ... to inspect.

Epic Games Store

Options:

  • Run node epic-games (browser window will open, headless leads to captcha)
  • Run inside Docker (browser is hidden, headless for host):
    • Install Docker
    • Options:
      • docker run command from above
      • npm run docker which does the same but stores files in ./data instead of a Docker volume.
      • docker compose up
    • When you need to login, go to http://localhost:6080 (you can also connect with a VNC client on port 5900)

Amazon Prime Gaming

Run node prime-gaming (locally or in Docker).

Runs headless. Run node prime-gaming show to show the GUI (to login).

Claiming the Amazon Games works, external Epic Games also work if the account is linked. Keys for {Origin, GOG.com, Legacy Games} should be printed to the console and need to be redeemed manually at the URL printed to the terminal (issue). A screenshot of the page with the code is saved to data/screenshots as well.

Run periodically

Epic Games usually has two free games every week, before Christmas every day. Prime Gaming has new games every month or more often during Prime days.

It is save to run both scripts every day. If you can't use Docker for quasi-headless mode, you could run in a virtual machine, on a server, or you wake your PC at night to avoid being interrupted.

History/DevLog

Click to expand

Tried epicgames-freebies-claimer, but does not work anymore since epicgames introduced hcaptcha (see issue).

Played around with puppeteer before, now trying newer https://playwright.dev which is pretty similar. Playwright Inspector and codegen to generate scripts are nice, but failed to generate the right code for clicking a button in an iframe.

Added main.spec.ts which was the test script generated by npx playwright codegen with manual fix for clicking buttons in the created iframe. Can be executed by npx playwright test. The test runner has options --debug and --timeout and can execute typescript which is nice. However, this only worked up to the button 'I Agree', and then showed an hcaptcha.

Added main.captcha.js which uses beta of playwright-extra@next and @extra/recaptcha@next (from comment on puppeteer-extra). However, playwright-extra seems to be old and missing :has-text selector (fixed here) and page.frameLocator, so the script did not run without adjustments. Also, solving via 2captcha is a paid service which takes time and may be unreliable.

Added main.stealth.js which uses the stealth plugin without playwright-extra wrapper but up-to-date playwright (from comment). The listed evasions are enough to not show an hcaptcha. Script claimed game successfully in non-headless mode.

Removed main.captcha.js. Using Playwright Test (main.spec.ts) instead of Library (main.stealth.js) has the advantage of free CLI like --debug and --timeout.

Button selectors should preferably use text in order to be more stable against changes in the DOM.

Renamed repository from epicgames-claimer to free-games-claimer since a script for Amazon Prime Gaming was also added. Removed all old scripts in favor of just epic-games.js and prime-gaming.js.

epic games: headless mode gets hcaptcha challenge. More details/references in issue.