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

编辑推荐精选

蛙蛙写作

蛙蛙写作

AI小说写作助手,一站式润色、改写、扩写

蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。

AI辅助写作AI工具蛙蛙写作AI写作工具学术助手办公助手营销助手AI助手
Trae

Trae

字节跳动发布的AI编程神器IDE

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

AI工具TraeAI IDE协作生产力转型热门
问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

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

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

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

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

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

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

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

下拉加载更多