Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

MasonStooksbury/Free-Games

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Free_Games.py


DEPRECATED

Please use the new-and-improved version that uses the Epic Games Desktop application instead of the web browser: Free-Games-V2



Original README

Literally just a script that is automatically ran via Windows Task Scheduler or Cron that logs into the Epic Games Store website and grabs the free games for the week. I've tested it on Windows, but there isn't any reason it wouldn't work on Linux as well. Just change the top line from #! python3 to #!/usr/bin/python3 and it should be fine.

Big shout-out to @ergoithz and their amazing function that finds the xpath for a given BeautifulSoup object. These updates wouldn't be possible without it! Check out their super-helpful function here: https://gist.github.com/ergoithz/6cf043e3fdedd1b94fcf

Another huge shout-out to @SonOfDiablo for creating and providing their awesome PowerShell script for installing geckodriver on Windows! Now you don't have to follow all the steps mentioned before. Just install the PowerShell script, and run it. This will: download and install the latest geckodriver for the correct architecture, install it, and add it to your path if it isn't already there: automagically! Find the script here: https://gist.github.com/SonOfDiablo/81f3d610295c69c777b512e4da90393d

Finally, a warm thank you to:

  • @Andriesmenze for fixing the script to work in the EU due to certain pop-ups that I wasn't seeing. Their work is very appreciated!
  • @Steve-Tech for adding some code to click the "Sign in with Epic Games" that apparently shows up now.
  • @Spifffff for modifying the Xpath for the cookies banner, for noticing that EGS requires email-only for logging in now, and for modifying the script to work with the games carousel that shows up sometimes
  • @lemasato for adding 2FA support, adding some more reliability and readability changes as well as adding functionality for multiple accounts to be used and staying on top of changes they do to the site like text on buttons and what not.
  • @Medallyon for cleaning up my README file, adding "requirements.txt" functionality, and making some important syntax changes as well as some credential detection stuff. This will help cut down on install time/complexity significantly.
  • @astranberg for expanding on multi-user support so you can now collect all the free games for multiple accounts.

Hope you enjoy! #! Mason Stooksbury

Updates! (12/21/2020)

  • Multi-user support so that free games can be claimed for as many accounts as you have.
  • Thank you again! In just a month we've gained like 20 more stars for a total of 80! And almost 10 more forks! You all continue to humble me with the amount of support this thing has gotten. Thank you again, and may your 2021 be so much better than this year.

Setup

Requirements

First, clone this repo using git clone https://github.com/MasonStooksbury/Free-Games.git. Then,

  1. Run pip install -r requirements.txt to automatically install dependencies

OR

Install them manually:

  • pip install lxml (for parsing the HTML from the webpage)
  • pip install selenium (for "roboting" the website)
  • pip install beautifulsoup4 (for better/more robust finding of objects and things)
  • pip install pyotp (for two-factor authentication)

Additionally

  • GeckoDriver (selenium needs this) Linux users can use this script to do everything for you after installing "jq" which is a JSON processor: https://gist.github.com/cgoldberg/4097efbfeb40adf698a7d05e75e0ff51. Windows users can use this script provided by @SonOfDiablo: https://gist.github.com/SonOfDiablo/81f3d610295c69c777b512e4da90393d.
  • Firefox - You can technically do all of this with Chrome, but it involves some more setup with selenium and particular drivers and I'm just too lazy. This works perfectly fine.
  • Enter the EPIC_EMAIL and EPIC_PASSWORD variables in the .env file to match your Epic Games Store account. Don't include any quotes here.
  • You may add multiple user accounts using comma separated values, e.g. [email protected],[email protected] EPIC_PASSWORD=pass1,pass2
  • While the scipt will technically work without 2FA enabled on your epic account, you will likely see many more captchas. In order to avoid this, follow the steps here to enable 2FA on your account and configure the script to work with your 2FA secret.
  • Finally, you may also want to jump into Free_Games.py and replace the user_agent variable (but you don't have to). There are instructions inside the script on how to do this.

Two-factor authentication

If you already have 2FA enabled on your account, you will be required to disable it temporarily. This is required to retrieve the key we need.

  1. Go to your Epic account settings and enable "Authenticator App".
  2. Keep a copy of the "Manual Entry Key". This will be used later in the python script. Do not close the page yet.
  3. On your phone, download Google Authenticator or another similar application.
  4. Using the application, scan the QR code visible on browser. Enter the code obtained from the application on the browser and click "Activate".
  5. Keep a copy of the "Rescue Codes". This will come in handy to retrieve your account if you ever lose access to your Authentificator application (losing phone, etc.)
  6. In the python script, input the "Manual Entry Key" retrieved earlier in the corresponding field, again leaving the single quotes as is.
  7. Done!

Finally

Now all you have to do is run python Free_Games.py, sit back & relax while your free games are being claimed (actually, you may have to complete a captcha upon signing in , but that's it).

Setting up Windows Task Scheduler

These steps should help you get Windows Task Scheduler setup in such a way that it will wake your computer from sleep and grab your free games then go back to sleep. It will also be setup to run again if something goes wrong as well as kill itself if it goes haywire. I realize the first picture shows it being setup for Vista and Windows Server 2008, but this was the only way it would work on Windows 10 without doing some wonky BIOS setup that only worked for some people.

  1. Fill out General:
    1. General
  2. Fill out Triggers:
    1. Triggers
  3. Fill out Actions:
    1. Actions
  4. Fill out Conditions:
    1. Conditions
  5. Fill out Settings:
    1. Settings

About

Please use the new-and-improved version that uses the Epic Games Desktop application instead of the web browser: https://github.com/MasonStooksbury/Free-Games-V2

Resources

License

Stars

Watchers

Forks

Languages