Convert Figma logo to code with AI

vogler logofree-games-claimer

Automatically claims free games on the Epic Games Store, Amazon Prime Gaming and GOG.

2,717
162
2,717
92

Top Related Projects

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.

Legendary - A free and open-source replacement for the Epic Games Launcher

Desktop implementation of Steam's mobile authenticator app

Claim available free game promotions from the Epic Games Store.

Quick Overview

Free-games-claimer is an automated tool designed to claim free games from various digital distribution platforms such as Epic Games Store, Amazon Prime Gaming, and GOG. It uses browser automation to log in to these platforms and claim available free games, saving users time and ensuring they don't miss out on limited-time offers.

Pros

  • Automates the process of claiming free games across multiple platforms
  • Saves time by eliminating the need to manually check and claim games
  • Ensures users don't miss out on limited-time free game offers
  • Supports multiple platforms including Epic Games Store, Amazon Prime Gaming, and GOG

Cons

  • Requires setting up and maintaining login credentials for each platform
  • May face issues with captchas or changes in website structures
  • Potential security risks associated with storing login information
  • Dependent on third-party libraries and browser drivers which may require updates

Code Examples

# Example of claiming Epic Games Store free games
async def claim_epic_games(page):
    await page.goto('https://store.epicgames.com/en-US/free-games')
    await page.wait_for_selector('.css-1myhtyb')
    free_games = await page.query_selector_all('.css-1myhtyb')
    for game in free_games:
        await game.click()
        await page.wait_for_selector('.css-1btn2zw')
        await page.click('.css-1btn2zw')
        # Additional steps for completing the claim process
# Example of claiming Amazon Prime Gaming rewards
async def claim_prime_gaming(page):
    await page.goto('https://gaming.amazon.com/')
    await page.wait_for_selector('.twitch-prime-offers')
    offers = await page.query_selector_all('.twitch-prime-offers .offer-card')
    for offer in offers:
        await offer.click()
        await page.wait_for_selector('.claim-button')
        await page.click('.claim-button')
        # Additional steps for completing the claim process
# Example of setting up the browser and running the claimer
async def main():
    browser = await launch(headless=False)
    page = await browser.new_page()
    await login(page)
    await claim_epic_games(page)
    await claim_prime_gaming(page)
    await browser.close()

asyncio.get_event_loop().run_until_complete(main())

Getting Started

  1. Clone the repository:

    git clone https://github.com/vogler/free-games-claimer.git
    cd free-games-claimer
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Set up your credentials in config.json:

    {
      "epic": {"email": "your_email", "password": "your_password"},
      "amazon": {"email": "your_email", "password": "your_password"}
    }
    
  4. Run the script:

    python main.py
    

Competitor Comparisons

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.

Pros of ArchiSteamFarm

  • More comprehensive Steam-focused functionality, including idling, card farming, and game management
  • Cross-platform support with builds for Windows, Linux, and macOS
  • Active development with frequent updates and a large community

Cons of ArchiSteamFarm

  • Steeper learning curve due to more complex features and configuration options
  • Primarily focused on Steam, while free-games-claimer supports multiple platforms

Code Comparison

ArchiSteamFarm (C#):

public sealed class Bot : IDisposable {
    public async Task<bool> AcceptDigitalGiftCard() {
        if (GiftCards == null || GiftCards.Count == 0) {
            return false;
        }
        // ... (gift card acceptance logic)
    }
}

free-games-claimer (TypeScript):

export async function claimEpicFreebies(page: Page) {
  await page.goto('https://www.epicgames.com/store/en-US/free-games');
  const freeGames = await page.$$('.css-1myhtyb');
  for (const game of freeGames) {
    // ... (game claiming logic)
  }
}

ArchiSteamFarm focuses on Steam-specific functionality with a more complex codebase, while free-games-claimer provides simpler, multi-platform game claiming capabilities.

SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.

Pros of SteamKit

  • More comprehensive and feature-rich, covering a wide range of Steam functionality
  • Better documentation and community support
  • Actively maintained with regular updates

Cons of SteamKit

  • Steeper learning curve due to its complexity
  • Requires more setup and configuration
  • Not specifically designed for claiming free games

Code Comparison

SteamKit (C#):

var steamClient = new SteamClient();
var manager = new CallbackManager(steamClient);
var user = steamClient.GetHandler<SteamUser>();

steamClient.Connect();
user.LogOn(new SteamUser.LogOnDetails { Username = username, Password = password });

free-games-claimer (JavaScript):

const epicGames = new EpicGames({ email, password });
await epicGames.login();
const freeGames = await epicGames.getPromotions();
await epicGames.claimOfferById(freeGames[0].id);

SteamKit is a more robust library for interacting with Steam's API, while free-games-claimer is specifically designed for claiming free games from multiple platforms. SteamKit offers greater flexibility but requires more setup, whereas free-games-claimer provides a simpler, more focused solution for its specific use case.

Legendary - A free and open-source replacement for the Epic Games Launcher

Pros of Legendary

  • More comprehensive CLI tool for managing Epic Games library
  • Supports game installation, launching, and updates
  • Actively maintained with frequent updates

Cons of Legendary

  • More complex setup and usage
  • Requires more system resources due to broader functionality
  • May be overkill for users only interested in claiming free games

Code Comparison

Free-games-claimer:

async def claim_free_games(page):
    await page.goto('https://www.epicgames.com/store/en-US/free-games')
    # ... (code to find and claim free games)

Legendary:

def claim_free_games(self):
    for game in self.egs.get_free_games():
        if not game['owned']:
            self.egs.claim_free_game(game['namespace'], game['id'])

Summary

Free-games-claimer is a lightweight tool focused solely on claiming free Epic Games, while Legendary is a more comprehensive CLI tool for managing the entire Epic Games library. Free-games-claimer is simpler to use but has limited functionality, whereas Legendary offers more features but requires more setup and resources. The choice between the two depends on the user's specific needs and preferences.

Desktop implementation of Steam's mobile authenticator app

Pros of SteamDesktopAuthenticator

  • Provides Steam-specific authentication functionality
  • Offers a desktop application for managing Steam accounts
  • Includes features like trade confirmations and market listings

Cons of SteamDesktopAuthenticator

  • Limited to Steam platform, not applicable for other game stores
  • Requires more setup and configuration for users
  • May have potential security risks if not used properly

Code Comparison

SteamDesktopAuthenticator:

public string GenerateSteamGuardCode()
{
    return GenerateSteamGuardCodeForTime(TimeAligner.GetSteamTime());
}

free-games-claimer:

async function claimEpicGames() {
  const browser = await puppeteer.launch({ headless: true });
  // ... (code to navigate and claim games)
  await browser.close();
}

The code snippets show that SteamDesktopAuthenticator focuses on generating Steam-specific authentication codes, while free-games-claimer uses web automation to claim games from different platforms.

SteamDesktopAuthenticator is tailored for Steam users who need advanced account management features, whereas free-games-claimer is designed for automatically claiming free games across multiple platforms. The choice between the two depends on the user's specific needs and the platforms they primarily use.

Claim available free game promotions from the Epic Games Store.

Pros of epicgames-freebies-claimer

  • More comprehensive support for multiple game platforms (Epic Games, GOG, Amazon Prime)
  • Active development with frequent updates and bug fixes
  • Larger community and more contributors, potentially leading to better support and feature additions

Cons of epicgames-freebies-claimer

  • More complex setup process due to additional dependencies and configuration options
  • Potentially higher resource usage due to broader feature set

Code Comparison

epicgames-freebies-claimer:

const { Launcher } = require('epicgames-client');
const client = new Launcher({
    email: 'example@email.com',
    password: 'password123'
});

free-games-claimer:

from epicstore_api import EpicGamesStoreAPI
api = EpicGamesStoreAPI()
api.login(email='example@email.com', password='password123')

The code snippets show different approaches to authentication:

  • epicgames-freebies-claimer uses a custom Launcher class from the epicgames-client library
  • free-games-claimer utilizes the epicstore_api library for a more straightforward authentication process

Both projects aim to automate the claiming of free games, but epicgames-freebies-claimer offers broader platform support and more active development, while free-games-claimer provides a simpler setup and potentially lower resource usage.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

logo-free-games-claimer

Code Smells

free-games-claimer

Claims free games periodically on

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.

I want to run without Docker or develop locally.
  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.

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

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.

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.

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

Click to expand

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

https://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.

v1.0 Standalone scripts node epic-games and node prime-gaming using Chromium.

Changed to Firefox for all scripts since Chromium led to captchas. Claiming then also worked in headless mode without Docker.

Added options via env vars, configurable in data/config.env.

Added OTP generation via otplib for automatic login, even with 2FA.

Added notifications via apprise.

Star History Chart

Alt


Logo with smaller aspect ratio (for Telegram bot etc.): 👾 - emojipedia

logo-fgc