No description
Find a file
Ralf Vogler a38e0def81 docker, #15: rm chromium profile lock before run
This locked the profile everytime a run was killed and made runs
afterwards time out. Maybe due to changed hostname, maybe due to how the
docker container kills playwright - didn't check.
https://bugs.chromium.org/p/chromium/issues/detail?id=367048
2022-05-05 16:36:32 +02:00
docker feat: use novnc, fix Thank you for buying timeout 2022-04-09 14:50:42 +07:00
.dockerignore fix: add screenshots to dockerignore 2022-04-01 02:00:49 +07:00
.gitignore epic-games: catch timeout and save screenshot of hcaptcha 2022-02-02 12:53:12 +01:00
Dockerfile Dockerfile: dos2unix ./docker/*.sh, #15 2022-05-04 02:04:04 +02:00
epic-games.js missing ; 2022-04-30 21:53:03 +02:00
jsconfig.json upgrade to ES6 modules and top-level await, add jsconfig.json with es2022 2022-02-24 18:27:25 +01:00
package-lock.json docker: cross-env for vars on Windows, #15 2022-05-04 09:51:29 +02:00
package.json docker, #15: rm chromium profile lock before run 2022-05-05 16:36:32 +02:00
prime-gaming.js prime-gaming: screenshot of claimed external game, print URL to redeem 2022-04-30 21:52:55 +02:00
README.md npm scripts for docker, update readme 2022-04-30 22:06:57 +02:00
util.js upgrade to ES6 modules and top-level await, add jsconfig.json with es2022 2022-02-24 18:27:25 +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 chromium

This downloads Chromium (343 MB) to a cache in home (doc).

Usage

Both scripts start an automated Chromium 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:

Amazon Prime Gaming

Run node prime-gaming

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 screenshots as well.

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.