No description
Find a file
Ralf Vogler d1aad10fac fix locale to en-US
epic-games otherwise uses OS locale for text:
https://github.com/vogler/free-games-claimer/pull/7
2022-02-12 19:54:09 +01:00
.gitignore epic-games: catch timeout and save screenshot of hcaptcha 2022-02-02 12:53:12 +01:00
epic-games.js fix locale to en-US 2022-02-12 19:54:09 +01:00
package-lock.json rm main.captcha.js 2021-12-28 17:25:01 +01:00
package.json annotate context type, defaultTimeout 30s -> 10s 2021-12-28 18:26:27 +01:00
prime-gaming.js fix locale to en-US 2022-02-12 19:54:09 +01:00
README.md link issue redeem keys on external stores for prime-gaming 2022-02-03 12:54:36 +01:00
util.js claimer for Amazon Prime Gaming (no ext stores) 2022-01-13 20:04:13 +01:00

free-games-claimer

Claims free games on

Setup

... should be the same on Windows/macOS/Linux:

  1. Install Node.js
  2. Clone/download this repository and cd into it in a terminal
  3. Run npm install && npx playwright install

This downloads {chromium, firefox, webkit} (742 MB) to a cache in home (doc).

Usage

Both scripts start an automated Chrome instance. It will first check if you are logged in, and if not wait for you to do so. After login, you can also restart the script if it does not redirect back.

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

Ideally, claiming would run in headless mode (without browser GUI - comment out headless: false to test), and on a Raspberry Pi:

  • Epic Games Store detects running in headless mode (despite stealth plugin) and gets stuck with a captcha challenge (issue). Did not test it yet for Prime Gaming.
  • Playwright seems to not run on (headless) RPi? See issue.

Epic Games Store

Run node epic-games

Login: Instead of redirecting back, the website seems to just reload the login URL. Go to https://www.epicgames.com/store/en-US/free-games manually, or restart the script.

Amazon Prime Gaming

Run node prime-gaming

Claiming the Amazon Games works, external Epic Games also work if the account is linked. Keys for Origin and GOG should be printed to the console and need to be redeemed manually at the moment (issue). Other stores not tested.

Run periodically

Epic Games releases one (sometimes more) free game every week, but around christmas every day. Prime Gaming has new games every month.

It is save to run both scripts every day. Since they are not running headless, it makes sense to run them at a time or on a machine that you are not actively using at that point. You could run them in a virtual machine, on a server, or you wake your PC at night to do it.

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.