The project contains a selenium bot which was created to automate the Energy Air or Energy Star Night competition. It is only intended as a POC and not to be used to win real tickets. (If you want to win tickets with it, you do it at your own risk.)
The project contains a selenium bot which was created to automate the Energy Air or Energy Star Night competition. It is only intended as a POC and not to be used to win real tickets. (If you want to win tickets with it, you do it at your own risk.)
It is written in Python3 and requires an Android app to redirect the SMS.
After successful implementation of the Smartphone app and the Python Bot, the SMS code is automatically read after the end of the session and the game starts from the beginning.
After downloading the file, run it. During the installation it is important to note that the check mark under "Add Python 3.7 to PATH" is set.\
Now open CMD and navigate to the folder "selenium-energy-bot":
```
cd \path\to\your\folder\selenium-energy-bot
```
There virtualenv must be installed:
```
pip3 install virtualenv
virtualenv venv
```
or:
```
python -m .\venv
```
Afterwards:
```
venv\Scripts\activate.bat
pip install -r requirements.txt
```
### Gmail Account needed
* Click on [Enable The GMAIL API](https://developers.google.com/gmail/api/quickstart/python) and "Download Client Config".
* In the Gmail Inbox [mail.google.com](https://mail.google.com/) create a new "label".
* Under Settings (top right), go to "Filters & blocked addresses "Create new filter".
* As subject: *Forward SMS message from number [+41YOURNR] (sender - Energy (No contact specified))*
* Contains the words: *Dein Code für game.energy.ch*
* Create a filter and apply it to the newly created label.
### Download APP PlayStore
* Download App [SMS to mail/phone - auto redirect](https://play.google.com/store/apps/details?id=com.gawk.smsforwarder)
* Configure the app to forward the SMS to your previously configured Gmail.
* Attention: The app must remain open in the background, so do not delete the app from the "open apps". Possibly adjust the energy plan on your mobile phone.
### App Iphone (optional)
* If you don't have an Android, you can also use a corresponding app from the Appstore, which redirects SMS to Mail. The regex to find the code in the string has to be adjusted in the gmail_nrg_code.py script.\
Possible App: [mysms mirror: Forward SMS](https://apps.apple.com/ch/app/mysms-mirror-sms-weiterleiten/id681057282)
### Other Downloads (REQUIRED)
* Download the [Chrome Webdriver](https://chromedriver.chromium.org/downloads) in the appropriate version for your browser.\
Find out the Webdriver version:
1. open Chrome Browser
2. click on the three points in the upper right corner
3. help, then "about Google Chrome"
4. at the top you will see "Version 78.0.3904.97"
* Alternatively you can also use webdriver of Edge or IE. But I personally had the best experiences with Chrome (adjust the webdriver in the script nggame_2019.py if you want to change it).
## Usage
### Unique execution
* Place credentials.json (GMAIL Api Auth) and chromedriver.exe in the project folder.
* In gmail_nrg_code.py there is a place (marked with Uncomment). Comment this block (Attention: After the "#" there is still a space, delete it).
* Comment the function (main()) at the last place in the code and execute the script.
```
python gmail_nrg_code.py
```
* Copy the id of the label and paste it at the following code position:
"Jastina Doreen, Ex-Miss Schweiz",# ----------------------- (WEN KÜSSTE ENERGY MODERATOR JONTSCH AN DER LETZTJÄHRIGEN ENERGY STAR NIGHT?)
"3",# ----------------------------------------------------- (WIE VIELE ENERGY MUSIC AWARDS (IN ZUSAMMENARBEIT MIT DEM SCHWEIZERISCHEN ROTEN KREUZ) WURDEN BISHER VERLIEHEN?)
"gewinnen",# ---------------------------------------------- (ENERGY STAR NIGHT TICKETS KANN MAN AUSSCHLIESSLICH…)
"Die fünfzehnte",# Dieses Jahr ist die 17 Energy Star Night!
"Energy Stars For Free",# --------------------------------- (DIE ENERGY STAR NIGHT HIESS EHEMALS...)
"dem Schweizerischen Roten Kreuz",# ------------------------ (DER ENERGY MUSIC AWARD WIRD JEWEILS IN ZUSAMMENARBEIT MIT ... VERLIEHEN?)
"Ein Schweizer Musikpreis",# ------------------------------ (WAS IST DER ENERGY MUSIC AWARD?)
"Energy Star Night findet trotzdem statt",# ---------------
"Möbel",# ------------------------------------------------- (WAS KANN MAN BEI LIPO KAUFEN?)
"Oktober 2016",# ------------------------------------------ (WANN WURDE ENERGY STARS FOR FREE IN ENERGY STAR NIGHT UMBENANNT?)
"Stefanie Heinzmann",# ------------------------------------ (WELCHER ACT ERÖFFNETE DIE ENERGY STAR NIGHT 2018?)
"Usgang.ch",# --------------------------------------------- (WELCHES UNTERNEHMEN IST «MEDIENPARTNER» DER ENERGY STAR NIGHT 2019?)
"im Radio, auf der Event-Website und über Social Media",# - (WO ERFÄHRST DU IMMER DIE NEUSTEN INFOS RUND UM DIE ENERGY STAR NIGHT?)
"Vorhänge individuell konfigurieren",# -------------------- (WAS VERSTECKT SICH HINTER DEM BEGRIFF «MASSDESIGN» BEI LIPO?)
"Orange",# ------------------------------------------------ (WELCHE FARBE HAT DAS LIPO LOGO?)
"das grösste Indoor Musik-Event der Schweiz",# ------------ (DIE ENERGY STAR NIGHT IST…)
"22",# ---------------------------------------------------- (AN WIE VIELEN STANDORTEN BIETET LIPO AKTUELL ALLES AN, WAS ES ZUM WOHNEN BRAUCHT)
"22. November 2019",# ------------------------------------- (WANN FINDET DIE ENERGY STAR NIGHT 2019 STATT?)
"Postkarte",# --------------------------------------------- (AUF WELCHEM WEG KANN MAN KEINE ENERGY STAR NIGHT TICKETS GEWINNEN?)
"Hallenstadion, Zürich",# --------------------------------- (IN WELCHER EVENTLOCATION FINDET DIE ENERGY STAR NIGHT STATT?)
"«The Game Is On»",#Geraten ------------------------------- (WIE LAUTETE DAS MOTTO DER ENERGY STAR NIGHT 2018?)