{"id":13622054,"url":"https://github.com/vogler/free-games-claimer","last_synced_at":"2025-04-10T13:49:29.582Z","repository":{"id":39989112,"uuid":"442266773","full_name":"vogler/free-games-claimer","owner":"vogler","description":"Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG.","archived":false,"fork":false,"pushed_at":"2025-03-27T16:11:30.000Z","size":646,"stargazers_count":3189,"open_issues_count":111,"forks_count":179,"subscribers_count":34,"default_branch":"main","last_synced_at":"2025-04-03T09:39:07.138Z","etag":null,"topics":["amazon-games","automation","claimer","docker","epic-games","epic-games-store","free-games","freebies","gog","playwright","prime-gaming","puppeteer"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vogler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"vogler","patreon":"fgc","open_collective":null,"ko_fi":"vogler","tidelift":null,"community_bridge":null,"liberapay":"vogler","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://www.buymeacoffee.com/vogler","https://paypal.me/voglerr"]}},"created_at":"2021-12-27T20:30:55.000Z","updated_at":"2025-04-03T09:32:29.000Z","dependencies_parsed_at":"2023-09-24T09:49:48.349Z","dependency_job_id":"ad867be8-fc43-42fb-9c4f-75cbcdee21c2","html_url":"https://github.com/vogler/free-games-claimer","commit_stats":{"total_commits":525,"total_committers":16,"mean_commits":32.8125,"dds":0.07428571428571429,"last_synced_commit":"33d2493336361197b12ffda6febec10cbfa6c471"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogler%2Ffree-games-claimer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogler%2Ffree-games-claimer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogler%2Ffree-games-claimer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vogler%2Ffree-games-claimer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vogler","download_url":"https://codeload.github.com/vogler/free-games-claimer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248227687,"owners_count":21068509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-games","automation","claimer","docker","epic-games","epic-games-store","free-games","freebies","gog","playwright","prime-gaming","puppeteer"],"created_at":"2024-08-01T21:01:13.388Z","updated_at":"2025-04-10T13:49:29.556Z","avatar_url":"https://github.com/vogler.png","language":"JavaScript","funding_links":["https://github.com/sponsors/vogler","https://patreon.com/fgc","https://ko-fi.com/vogler","https://liberapay.com/vogler","https://www.buymeacoffee.com/vogler","https://paypal.me/voglerr"],"categories":["JavaScript","automation"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg alt=\"logo-free-games-claimer\" src=\"https://user-images.githubusercontent.com/493741/214588518-a4c89998-127e-4a8c-9b1e-ee4a9d075715.png\" /\u003e\n\u003c/p\u003e\n\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=vogler_free-games-claimer\u0026metric=code_smells)](https://sonarcloud.io/project/overview?id=vogler_free-games-claimer)\n# free-games-claimer\n\nClaims free games periodically on\n- \u003cimg src=\"https://github.com/user-attachments/assets/82e9e9bf-b6ac-4f20-91db-36d2c8429cb6\" width=\"32\" align=\"middle\" /\u003e [Epic Games Store](https://www.epicgames.com/store/free-games)\n- \u003cimg src=\"https://github.com/user-attachments/assets/7627a108-20c6-4525-a1d8-5d221ee89d6e\" width=\"32\" align=\"middle\" /\u003e [Amazon Prime Gaming](https://gaming.amazon.com)\n- \u003cimg src=\"https://github.com/user-attachments/assets/49040b50-ee14-4439-8e3c-e93cafd7c3a5\" width=\"32\" align=\"middle\" /\u003e [GOG](https://www.gog.com)\n- \u003cimg src=\"https://github.com/user-attachments/assets/3582444b-f23b-448d-bf31-01668cd0313a\" width=\"32\" align=\"middle\" /\u003e [Unreal Engine (Assets)](https://www.unrealengine.com/marketplace/en-US/assets?count=20\u0026sortBy=effectiveDate\u0026sortDir=DESC\u0026start=0\u0026tag=4910) ([experimental](https://github.com/vogler/free-games-claimer/issues/44), same login as Epic Games)\n\u003c!-- - \u003cimg src=\"https://www.freepnglogos.com/uploads/xbox-logo-picture-png-14.png\" width=\"32\"/\u003e [Xbox Live Games with Gold](https://www.xbox.com/en-US/live/gold#gameswithgold) ([experimental](https://github.com/vogler/free-games-claimer/issues/19)) --\u003e\n\nPull requests welcome :)\n\n![Telegram Screenshot](https://user-images.githubusercontent.com/493741/214667078-eb5c1877-2bdd-40c1-b94e-4a50d6852c06.png)\n\n_Works on Windows/macOS/Linux._\n\nRaspberry Pi (3, 4, Zero 2): [requires 64-bit OS](https://github.com/vogler/free-games-claimer/issues/3) like Raspberry Pi OS or Ubuntu (Raspbian won't work since it's 32-bit).\n\n## How to run\nEasy option: [install Docker](https://docs.docker.com/get-docker/) (or [podman](https://podman-desktop.io/)) and run this command in a terminal:\n```\ndocker run --rm -it -p 6080:6080 -v fgc:/fgc/data --pull=always ghcr.io/vogler/free-games-claimer\n```\n\n_This currently gives you a captcha challenge for epic-games. Until [issue #183](https://github.com/vogler/free-games-claimer/issues/183) is fixed, it is recommended to just run `node epic-games` without docker (see below)._\n\nThis will run `node epic-games; node prime-gaming; node gog` - if you only want to claim games for one of the stores, you can override the default command by appending e.g. `node epic-games` at the end of the `docker run` command, or if you want several `bash -c \"node epic-games.js; node gog.js\"`.\nData (including json files with claimed games, codes to redeem, screenshots) is stored in the Docker volume `fgc`.\n\n\u003cdetails\u003e\n  \u003csummary\u003eI want to run without Docker or develop locally.\u003c/summary\u003e\n\n1. [Install Node.js](https://nodejs.org/en/download)\n2. Clone/download this repository and `cd` into it in a terminal\n3. Run `npm install`\n4. Run `pip install apprise` (or use [pipx](https://github.com/pypa/pipx) if you have [problems](https://stackoverflow.com/questions/75608323/how-do-i-solve-error-externally-managed-environment-every-time-i-use-pip-3)) to install [apprise](https://github.com/caronc/apprise) if you want notifications\n5. To get updates: `git pull; npm install`\n6. Run `node epic-games`, `node prime-gaming`, `node gog`...\n\nDuring `npm install` Playwright will download its Firefox to a cache in home ([doc](https://playwright.dev/docs/browsers#managing-browser-binaries)).\nIf you are missing some dependencies for the browser on your system, you can use `sudo npx playwright install firefox --with-deps`.\n\nIf you don't want to use Docker for quasi-headless mode, you could run inside a virtual machine, on a server, or you wake your PC at night to avoid being interrupted.\n\u003c/details\u003e\n\n## Usage\nAll scripts start an automated Firefox instance, either with the browser GUI shown or hidden (*headless mode*). By default, you won't see any browser open on your host system.\n\n- When running inside Docker, the browser will be shown only inside the container. You can open http://localhost:6080 to interact with the browser running inside the container via noVNC (or use other VNC clients on port 5900).\n- When running the scripts outside of Docker, the browser will be hidden by default; you can use `SHOW=1 ...` to show the UI (see options below).\n\nWhen running the first time, you have to login for each store you want to claim games on.\nYou can login indirectly via the terminal or directly in the browser. The scripts will wait until you are successfully logged in.\n\nThere will be prompts in the terminal asking you to enter email, password, and afterwards some OTP (one time password / security code) if you have 2FA/MFA (two-/multi-factor authentication) enabled. If you want to login yourself via the browser, you can press escape in the terminal to skip the prompts.\n\nAfter login, the script will continue claiming the current games. If it still waits after you are already logged in, you can restart it (and open an issue). If you run the scripts regularly, you should not have to login again.\n\n### Configuration / Options\nOptions are set via [environment variables](https://kinsta.com/knowledgebase/what-is-an-environment-variable/) which allow for flexible configuration.\n\nTODO: ~~On the first run, the script will guide you through configuration and save all settings to `data/config.env`. You can edit this file directly or run `node fgc config` to run the configuration assistant again.~~\n\nAvailable options/variables and their default values:\n\n| Option        \t| Default \t| Description                                                            \t|\n|---------------\t|---------\t|------------------------------------------------------------------------\t|\n| SHOW          \t| 1       \t| Show browser if 1. Default for Docker, not shown when running outside. \t|\n| WIDTH         \t| 1280    \t| Width of the opened browser (and of screen for VNC in Docker).         \t|\n| HEIGHT        \t| 1280    \t| Height of the opened browser (and of screen for VNC in Docker).        \t|\n| VNC_PASSWORD  \t|         \t| VNC password for Docker. No password used by default!                  \t|\n| NOTIFY        \t|         \t| Notification services to use (Pushover, Slack, Telegram...), see below. [Apprise](https://github.com/caronc/apprise)\t|\n| NOTIFY_TITLE  \t|         \t| Optional title for notifications, e.g. for Pushover.                   \t|\n| BROWSER_DIR   \t| data/browser\t| Directory for browser profile, e.g. for multiple accounts.         \t|\n| TIMEOUT       \t| 60      \t| Timeout for any page action. Should be fine even on slow machines.     \t|\n| LOGIN_TIMEOUT \t| 180     \t| Timeout for login in seconds. Will wait twice (prompt + manual login). \t|\n| EMAIL         \t|         \t| Default email for any login.                                           \t|\n| PASSWORD      \t|         \t| Default password for any login.                                        \t|\n| EG_EMAIL      \t|         \t| Epic Games email for login. Overrides EMAIL.                           \t|\n| EG_PASSWORD   \t|         \t| Epic Games password for login. Overrides PASSWORD.                     \t|\n| EG_OTPKEY     \t|         \t| Epic Games MFA OTP key.                                                \t|\n| EG_PARENTALPIN \t|         \t| Epic Games Parental Controls PIN.                                      \t|\n| PG_EMAIL      \t|         \t| Prime Gaming email for login. Overrides EMAIL.                         \t|\n| PG_PASSWORD   \t|         \t| Prime Gaming password for login. Overrides PASSWORD.                   \t|\n| PG_OTPKEY     \t|         \t| Prime Gaming MFA OTP key.                                              \t|\n| PG_REDEEM     \t| 0       \t| Prime Gaming: try to redeem keys on external stores ([experimental](https://github.com/vogler/free-games-claimer/issues/5)).    \t|\n| PG_CLAIMDLC   \t| 0       \t| Prime Gaming: try to claim DLCs ([experimental](https://github.com/vogler/free-games-claimer/issues/55)).    \t|\n| GOG_EMAIL     \t|         \t| GOG email for login. Overrides EMAIL.                                  \t|\n| GOG_PASSWORD  \t|         \t| GOG password for login. Overrides PASSWORD.                            \t|\n| GOG_NEWSLETTER\t| 0       \t| Do not unsubscribe from newsletter after claiming a game if 1.         \t|\n| LG_EMAIL        |         \t| Legacy Games: email to use for redeeming (if not set, defaults to PG_EMAIL)  |\n\nSee `src/config.js` for all options.\n\n#### How to set options\nYou can add options directly in the command or put them in a file to load.\n\n##### Docker\nYou can pass variables using `-e VAR=VAL`, for example `docker run -e EMAIL=foo@bar.baz -e NOTIFY='tgram://bottoken/ChatID' ...` or using `--env-file fgc.env` where `fgc.env` is a file on your host system (see [docs](https://docs.docker.com/engine/reference/commandline/run/#env)). You can also `docker cp` your configuration file to `/fgc/data/config.env` in the `fgc` volume to store it with the rest of the data instead of on the host ([example](https://github.com/moby/moby/issues/25245#issuecomment-365980572)).\nIf you are using [docker compose](https://docs.docker.com/compose/environment-variables/) (or Portainer etc.), you can put options in the `environment:` section.\n\n##### Without Docker\nOn Linux/macOS you can prefix the variables you want to set, for example `EMAIL=foo@bar.baz SHOW=1 node epic-games` will show the browser and skip asking you for your login email. On Windows you have to use `set`, [example](https://github.com/vogler/free-games-claimer/issues/314).\nYou can also put options in `data/config.env` which will be loaded by [dotenv](https://github.com/motdotla/dotenv).\n\n### Notifications\nThe scripts will try to send notifications for successfully claimed games and any errors like needing to log in or encountered captchas (should not happen).\n\n[apprise](https://github.com/caronc/apprise) is used for notifications and offers many services including Pushover, Slack, Telegram, SMS, Email, desktop and custom notifications.\nYou just need to set `NOTIFY` to the notification services you want to use, e.g. `NOTIFY='mailto://myemail:mypass@gmail.com' 'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'` - refer to their list of services and [examples](https://github.com/caronc/apprise#command-line-usage).\n\n### Automatic login, two-factor authentication\nIf you set the options for email, password and OTP key, there will be no prompts and logins should happen automatically. This is optional since all stores should stay logged in since cookies are refreshed.\nTo get the OTP key, it is easiest to follow the store's guide for adding an authenticator app. You should also scan the shown QR code with your favorite app to have an alternative method for 2FA.\n\n- **Epic Games**: visit [password \u0026 security](https://www.epicgames.com/account/password), enable 'third-party authenticator app', copy the 'Manual Entry Key' and use it to set `EG_OTPKEY`.\n- **Prime Gaming**: visit Amazon 'Your Account › Login \u0026 security', 2-step verification › Manage › Add new app › Can't scan the barcode, copy the bold key and use it to set `PG_OTPKEY`\n- **GOG**: only offers OTP via email\n\u003c!-- - **Xbox**: visit [additional security](https://account.live.com/proofs/manage/additional) \u003e Add a new way to sign in or verify \u003e Use an app \u003e Set up a different Authenticator app \u003e I can't scan the bar code \u003e copy the bold key and use it to set `XBOX_OTPKEY` --\u003e\n\nBeware that storing passwords and OTP keys as clear text may be a security risk. Use a unique/generated password! TODO: maybe at least offer to base64 encode for storage.\n\n### Epic Games Store\nRun `node epic-games` (locally or in Docker).\n\n### Amazon Prime Gaming\nRun `node prime-gaming` (locally or in Docker).\n\nClaiming the Amazon Games works out-of-the-box, however, for games on external stores you need to either link your account or redeem a key.\n\n- Stores that require account linking: Epic Games, Battle.net, Origin.\n- Stores that require redeeming a key: GOG.com, Microsoft Games, Legacy Games.\n  \n  Keys and URLs are printed to the console, included in notifications and saved in `data/prime-gaming.json`. A screenshot of the page with the key is also saved to `data/screenshots`.\n  [TODO](https://github.com/vogler/free-games-claimer/issues/5): ~~redeem keys on external stores.~~\n\n\u003c!-- ### Xbox Games With Gold --\u003e\n\u003c!-- Run `node xbox` (locally or in docker). --\u003e\n\n### Run periodically\n#### How often?\nEpic Games usually has two free games *every week*, before Christmas every day.\nPrime Gaming has new games *every month* or more often during Prime days.\nGOG usually has one new game every couples of weeks.\nUnreal Engine has new assets to claim *every first Tuesday of a month*.\n\u003c!-- Xbox usually has two games *every month*. --\u003e\n\nIt is safe to run the scripts every day.\n\n#### How to schedule?\nThe container/scripts will claim currently available games and then exit.\nIf you want it to run regularly, you have to schedule the runs yourself:\n\n- Linux/macOS: `crontab -e` ([example](https://github.com/vogler/free-games-claimer/discussions/56))\n- macOS: [launchd](https://stackoverflow.com/questions/132955/how-do-i-set-a-task-to-run-every-so-often)\n- Windows: [task scheduler](https://active-directory-wp.com/docs/Usage/How_to_add_a_cron_job_on_Windows/Scheduled_tasks_and_cron_jobs_on_Windows/index.html) ([example](https://github.com/vogler/free-games-claimer/wiki/%5BHowTo%5D-Schedule-runs-on-Windows)), [other options](https://stackoverflow.com/questions/132971/what-is-the-windows-version-of-cron), or just put the command in a `.bat` file in Autostart if you restart often...\n- any OS: use a process manager like [pm2](https://pm2.keymetrics.io/docs/usage/restart-strategies/)\n- Docker Compose `command: bash -c \"node epic-games; node prime-gaming; node gog; echo sleeping; sleep 1d\"` additionally add `restart: unless-stopped` to it.\n\nTODO: ~~add some server-mode where the script just keeps running and claims games e.g. every day.~~\n\n### Problems?\n\nCheck the open [issues](https://github.com/vogler/free-games-claimer/issues) and comment there or open a new issue.\n\nIf you're a developer, you can use `PWDEBUG=1 ...` to [inspect](https://playwright.dev/docs/inspector) which opens a debugger where you can step through the script.\n\n\n## History/DevLog\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nTried [epicgames-freebies-claimer](https://github.com/Revadike/epicgames-freebies-claimer), but had problems since epicgames introduced hcaptcha (see [issue](https://github.com/Revadike/epicgames-freebies-claimer/issues/172)).\n\nPlayed around with puppeteer before, now trying newer https://playwright.dev which is pretty similar.\nPlaywright Inspector and `codegen` to generate scripts are nice, but failed to generate the right code for clicking a button in an iframe.\n\nAdded [main.spec.ts](https://github.com/vogler/epicgames-claimer/commit/e5ce7916ab6329cfc7134677c4d89c2b3fa3ba97#diff-d18d03e9c407a20e05fbf03cbd6f9299857740544fb6b50d6a70b9c6fbc35831) 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.\n\nAdded [main.captcha.js](https://github.com/vogler/epicgames-claimer/commit/e5ce7916ab6329cfc7134677c4d89c2b3fa3ba97#diff-d18d03e9c407a20e05fbf03cbd6f9299857740544fb6b50d6a70b9c6fbc35831) which uses beta of `playwright-extra@next` and `@extra/recaptcha@next` (from [comment on puppeteer-extra](https://github.com/berstend/puppeteer-extra/pull/303#issuecomment-775277480)).\nHowever, `playwright-extra` seems to be old and missing `:has-text` selector (fixed [here](https://github.com/vogler/epicgames-claimer/commit/ba97a0e840b65f4476cca18e28d8461b0c703420)) and `page.frameLocator`, so the script did not run without adjustments.\nAlso, solving via [2captcha](https://2captcha.com?from=13225256) is a paid service which takes time and may be unreliable.\n\u003c!-- Alternative: https://anti-captcha.com --\u003e\n\nAdded [main.stealth.js](https://github.com/vogler/epicgames-claimer/commit/64d0ba8ce71baec3947d1b64acd567befcb39340#diff-f70d3bd29df4a343f11062a97063953173491ce30fe34f69a0fc52517adbf342) which uses the stealth plugin without `playwright-extra` wrapper but up-to-date `playwright` (from [comment](https://github.com/berstend/puppeteer-extra/issues/454#issuecomment-917437212)).\nThe listed evasions are enough to not show an hcaptcha. Script claimed game successfully in non-headless mode.\n\nRemoved `main.captcha.js`.\nUsing Playwright Test (`main.spec.ts`) instead of Library (`main.stealth.js`) has the advantage of free CLI like `--debug` and `--timeout`.\n\u003c!-- TODO: check if stealth plugin can be setup with `contextOptions` ([doc](https://playwright.dev/docs/test-configuration#more-browser-and-context-options)). --\u003e\n\nButton selectors should preferably use text in order to be more stable against changes in the DOM.\n\nRenamed 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`.\n\nepic games: `headless` mode gets hcaptcha challenge. More details/references in [issue](https://github.com/vogler/free-games-claimer/issues/2).\n\nhttps://github.com/vogler/free-games-claimer/pull/11 introduced a Dockerfile for running non-headless inside the container via xvfb which makes it headless for the host running the container.\n\nv1.0 Standalone scripts node epic-games and node prime-gaming using Chromium.\n\nChanged to Firefox for all scripts since Chromium led to captchas. Claiming then also worked in headless mode without Docker.\n\nAdded options via env vars, configurable in `data/config.env`.\n\nAdded OTP generation via otplib for automatic login, even with 2FA.\n\nAdded notifications via [apprise](https://github.com/caronc/apprise).\n\u003c/details\u003e\n\n[![Star History Chart](https://api.star-history.com/svg?repos=vogler/free-games-claimer\u0026type=Date)](https://star-history.com/#vogler/free-games-claimer\u0026Date)\n\u003c!-- [![Stargazers over time](https://starchart.cc/vogler/free-games-claimer.svg?variant=adaptive)](https://starchart.cc/vogler/free-games-claimer) --\u003e\n\n![Alt](https://repobeats.axiom.co/api/embed/a1c5e6e420d90e0d6b34c1285e92a69a44138faa.svg \"Repobeats analytics image\")\n\n---\n\nLogo with smaller aspect ratio (for Telegram bot etc.): 👾 - [emojipedia](https://emojipedia.org/alien-monster/)\n\n![logo-fgc](https://user-images.githubusercontent.com/493741/214589922-093d6557-6393-421c-b577-da58ff3671bc.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvogler%2Ffree-games-claimer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvogler%2Ffree-games-claimer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvogler%2Ffree-games-claimer/lists"}