free-games-claimer

free-games-claimer

自动领取多平台免费游戏的开源工具

这是一个自动化工具,可定期从Epic Games Store、Amazon Prime Gaming和GOG等多个游戏平台领取免费游戏。它基于Playwright实现浏览器自动化,支持Windows、macOS和Linux系统运行,也可通过Docker容器部署。工具具备自动登录、两步验证和通知功能,能定期执行以获取最新免费游戏资源。对于想轻松汇集多平台免费游戏的玩家来说,这是一个便捷有效的选择。

free-games-claimer自动领取游戏平台Docker通知Github开源项目
<p align="center"> <img alt="logo-free-games-claimer" src="https://user-images.githubusercontent.com/493741/214588518-a4c89998-127e-4a8c-9b1e-ee4a9d075715.png" /> </p>

Code Smells

free-games-claimer

Claims free games periodically on

  • <img src="https://upload.wikimedia.org/wikipedia/commons/3/31/Epic_Games_logo.svg" width="32"/> Epic Games Store
  • <img src="https://seeklogo.com/images/P/prime-gaming-logo-61A701B3F5-seeklogo.com.png" width="32"/> Amazon Prime Gaming
  • <img src="https://static.wikia.nocookie.net/this-war-of-mine/images/1/1a/Logo_GoG.png/revision/latest?cb=20160711062658" width="32"/> GOG
  • <img src="https://cdn2.unrealengine.com/ue-logo-white-e34b6ba9383f.svg" width="32"/> Unreal Engine (Assets) (experimental, same login as Epic Games)
<!-- - <img src="https://www.freepnglogos.com/uploads/xbox-logo-picture-png-14.png" width="32"/> [Xbox Live Games with Gold](https://www.xbox.com/en-US/live/gold#gameswithgold) ([experimental](https://github.com/vogler/free-games-claimer/issues/19)) -->

Pull requests welcome :)

Telegram Screenshot

Works on Windows/macOS/Linux.

Raspberry Pi (3, 4, Zero 2): requires 64-bit OS like Raspberry Pi OS or Ubuntu (Raspbian won't work since it's 32-bit).

How to run

Easy option: install Docker (or podman) and run this command in a terminal:

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

This currently gives you a captcha challenge for epic-games. Until issue #183 is fixed, it is recommended to just run node epic-games without docker (see below).

This 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". Data (including json files with claimed games, codes to redeem, screenshots) is stored in the Docker volume fgc.

<details> <summary>I want to run without Docker or develop locally.</summary>
  1. Install Node.js
  2. Clone/download this repository and cd into it in a terminal
  3. Run npm install
  4. Run pip install apprise (or use pipx if you have problems) to install apprise if you want notifications
  5. To get updates: git pull; npm install
  6. Run node epic-games, node prime-gaming, node gog...

During npm install Playwright will download its 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.

If 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.

</details>

Usage

All 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.

  • 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).
  • 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).

When running the first time, you have to login for each store you want to claim games on. You can login indirectly via the terminal or directly in the browser. The scripts will wait until you are successfully logged in.

There 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.

After 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.

Configuration / Options

Options are set via environment variables which allow for flexible configuration.

TODO: 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.

Available options/variables and their default values:

OptionDefaultDescription
SHOW1Show browser if 1. Default for Docker, not shown when running outside.
WIDTH1280Width of the opened browser (and of screen for VNC in Docker).
HEIGHT1280Height of the opened browser (and of screen for VNC in Docker).
VNC_PASSWORDVNC password for Docker. No password used by default!
NOTIFYNotification services to use (Pushover, Slack, Telegram...), see below. Apprise
NOTIFY_TITLEOptional title for notifications, e.g. for Pushover.
BROWSER_DIRdata/browserDirectory for browser profile, e.g. for multiple accounts.
TIMEOUT60Timeout for any page action. Should be fine even on slow machines.
LOGIN_TIMEOUT180Timeout for login in seconds. Will wait twice (prompt + manual login).
EMAILDefault email for any login.
PASSWORDDefault password for any login.
EG_EMAILEpic Games email for login. Overrides EMAIL.
EG_PASSWORDEpic Games password for login. Overrides PASSWORD.
EG_OTPKEYEpic Games MFA OTP key.
EG_PARENTALPINEpic Games Parental Controls PIN.
PG_EMAILPrime Gaming email for login. Overrides EMAIL.
PG_PASSWORDPrime Gaming password for login. Overrides PASSWORD.
PG_OTPKEYPrime Gaming MFA OTP key.
PG_REDEEM0Prime Gaming: try to redeem keys on external stores (experimental).
PG_CLAIMDLC0Prime Gaming: try to claim DLCs (experimental).
GOG_EMAILGOG email for login. Overrides EMAIL.
GOG_PASSWORDGOG password for login. Overrides PASSWORD.
GOG_NEWSLETTER0Do not unsubscribe from newsletter after claiming a game if 1.
LG_EMAILLegacy Games: email to use for redeeming (if not set, defaults to PG_EMAIL)

See src/config.js for all options.

How to set options

You can add options directly in the command or put them in a file to load.

Docker

You 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). 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). If you are using docker compose (or Portainer etc.), you can put options in the environment: section.

Without Docker

On 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. You can also put options in data/config.env which will be loaded by dotenv.

Notifications

The scripts will try to send notifications for successfully claimed games and any errors like needing to log in or encountered captchas (should not happen).

apprise is used for notifications and offers many services including Pushover, Slack, Telegram, SMS, Email, desktop and custom notifications. You 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.

Automatic login, two-factor authentication

If 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. To 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.

  • Epic Games: visit password & security, enable 'third-party authenticator app', copy the 'Manual Entry Key' and use it to set EG_OTPKEY.
  • Prime Gaming: visit Amazon 'Your Account › Login & security', 2-step verification › Manage › Add new app › Can't scan the barcode, copy the bold key and use it to set PG_OTPKEY
  • GOG: only offers OTP via email
<!-- - **Xbox**: visit [additional security](https://account.live.com/proofs/manage/additional) > Add a new way to sign in or verify > Use an app > Set up a different Authenticator app > I can't scan the bar code > copy the bold key and use it to set `XBOX_OTPKEY` -->

Beware 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.

Epic Games Store

Run node epic-games (locally or in Docker).

Amazon Prime Gaming

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

Claiming 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.

  • Stores that require account linking: Epic Games, Battle.net, Origin.

  • Stores that require redeeming a key: GOG.com, Microsoft Games, Legacy Games.

    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. TODO: redeem keys on external stores.

<!-- ### Xbox Games With Gold --> <!-- Run `node xbox` (locally or in docker). -->

Run periodically

How often?

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. GOG usually has one new game every couples of weeks. Unreal Engine has new assets to claim every first Tuesday of a month.

<!-- Xbox usually has two games *every month*. -->

It is safe to run the scripts every day.

How to schedule?

The container/scripts will claim currently available games and then exit. If you want it to run regularly, you have to schedule the runs yourself:

  • Linux/macOS: crontab -e (example)
  • macOS: launchd
  • Windows: task scheduler (example), other options, or just put the command in a .bat file in Autostart if you restart often...
  • any OS: use a process manager like pm2
  • Docker Compose command: bash -c "node epic-games; node prime-gaming; node gog; echo sleeping; sleep 1d" additionally add restart: unless-stopped to it.

TODO: add some server-mode where the script just keeps running and claims games e.g. every day.

Problems?

Check the open issues and comment there or open a new issue.

If you're a developer, you can use PWDEBUG=1 ... to inspect which opens a debugger where you can step through the script.

History/DevLog

<details> <summary>Click to expand</summary>

Tried epicgames-freebies-claimer, but had problems 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

编辑推荐精选

博思AIPPT

博思AIPPT

AI一键生成PPT,就用博思AIPPT!

博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。

热门AI工具AI办公办公工具智能排版AI生成PPT博思AIPPT海量精品模板AI创作
潮际好麦

潮际好麦

AI赋能电商视觉革命,一站式智能商拍平台

潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。

iTerms

iTerms

企业专属的AI法律顾问

iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。

SimilarWeb流量提升

SimilarWeb流量提升

稳定高效的流量提升解决方案,助力品牌曝光

稳定高效的流量提升解决方案,助力品牌曝光

Sora2视频免费生成

Sora2视频免费生成

最新版Sora2模型免费使用,一键生成无水印视频

最新版Sora2模型免费使用,一键生成无水印视频

Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

AI助手热门AI工具AI创作AI辅助写作讯飞绘文内容运营个性化文章多平台分发
TRAE编程

TRAE编程

AI辅助编程,代码自动修复

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

热门AI工具生产力协作转型TraeAI IDE
商汤小浣熊

商汤小浣熊

最强AI数据分析助手

小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。

imini AI

imini AI

像人一样思考的AI智能体

imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。

下拉加载更多