Initial commit

feature/v2018
Michael Reber 4 years ago
parent 7a064c4452
commit 7cd6644527

@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://chromedriver.chromium.org/downloads

Binary file not shown.

@ -0,0 +1,190 @@
# -*- coding: utf-8 -*-
from selenium import webdriver
import time
#import gmail_nrg_code as nrg_code
print("© 2019 Michael Reber . ALL RIGHTS RESERVED.")
print("Created to win the endless energy game..")
print("\r")
print("May the Force be with you.")
print("Patience you must have, my young padawan.")
driver = webdriver.Chrome(executable_path=r"D:\Energy-Bot-2019\chromedriver.exe")
driver.get("https://game.energy.ch/")
# assert "Energy" in driver.title
answers = [
#################################################################
# ANTWORTEN FUERS ENERGY AIR 2019:
#"One Republic",
#"1300",
#"gewinnen",
#"XTRA-Circle",
#"Twitter",
#"E-Mail",
#"2014",
#"450 Tonnen",
#"70 Meter",
#"Die sechste",
#"Lo & Leduc",
#"im Radio, auf der Website und über Social Media",
#"40000",
#"Energy Air findet trotzdem statt",
#"Im Privatjet",
#"Stade de Suisse, Bern",
#"Bastian Baker",
#"60",
#"Um 17 Uhr", ## Kontzertbeginn 19:00
#"250",
#"Alvaro Soler",
#"14",
#"...der unter freiem Himmel stattfindet.",
#"Averdeck",
#"Sein Mami",
#"Eine komplett weisse Garderobe",
#"BSC Young Boys",
#"7. September 2019",
#################################################################
# AB HIER ANTWORTEN FUER ENERGY STAR NIGHT:
"Swisscom", # ---------------------------------------------- (WELCHES UNTERNEHMEN IST «PRESENTING PARTNER» DER ENERGY STAR NIGHT?)
"Über 1'000'000", #Geraten --------------------------------- (WIE VIELE KUNDEN BESUCHEN LIPO JÄHRLICH?)
"2003", # -------------------------------------------------- (WANN FAND DIE ENERGY STAR NIGHT (EHEMALS ENERGY STARS FOR FREE) ZUM ERSTEN MAL STATT?)
"Mark Forster", # ------------------------------------------ (WELCHER DIESER ACTS HATTE EINEN AUFTRITT AN DER ENERGY STAR NIGHT 2017?)
"Um 19:00 Uhr", # ------------------------------------------ (WANN IST KONZERTBEGINN DER ENERGY STAR NIGHT?)
"Reinach (Kanton Basel)", # -------------------------------- (IN WELCHER STADT ERÖFFNETE 1976 DIE ERSTE LIPO FILIALE DER SCHWEIZ?)
"Energy Star Night 2017", # -------------------------------- (WELCHE AUSGABE DER ENERGY STAR NIGHT WURDE ZULETZT AUF PRO7 SCHWEIZ ÜBERTRAGEN?)
"14'000", # ------------------------------------------------ (WIE VIELE ENERGY STAR NIGHT TICKETS WERDEN VERLOST?)
"Graubünden",# ---------------------------------------------
"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?)
"Hiltl Club, Zürich",# -------------------------------------
"Nemo", # -------------------------------------------------- (WELCHER SCHWEIZER ACT RÄUMTE DEN ENERGY MUSIC AWARD 2018 AB?)
"VIP", # --------------------------------------------------- (WELCHE TICKETKATEGORIE WIRD NICHT FÜR DIE ENERGY STAR NIGHT VERLOST?)
"Winterthur und Villeneuve", #Geraten ---------------------- (IN WELCHEN BEIDEN STÄDTEN ERÖFFNET LIPO AM 22. NOVEMBER 2019 JEWEILS EINE NEUE FILIALE?)
"Die tiefsten Preise der Schweiz", # ----------------------- (WAS GARANTIERT LIPO SEINEN KUNDEN?)
"#esn19", # ------------------------------------------------ (WIE LAUTET DER OFFIZIELLE HASHTAG DER ENERGY STAR NIGHT 2019?)
"Twitter", # ----------------------------------------------- (AUF WELCHER SOCIAL MEDIA PLATTFORM KANN MAN KEINE ENERGY STAR NIGHT TICKETS GEWINNEN?)
"Mex" #Geraten --------------------------------------------- (WIE HEISST DER HUND IM AKTUELLEN WERBESPOT?)
]
def press_answer(quest_nr):
for answer in answers:
try:
labelname = '//label[@for="' + answer + '"]'
elem1 = driver.find_elements_by_xpath(labelname)[0]
time.sleep(2)
elem1.click()
elem2 = driver.find_elements_by_xpath("//button[@id='next-question']")[0]
time.sleep(1)
elem2.click()
print(answer)
except:
pass
return quest_nr
question_Nr = 0
counter = 0
input("Press to enter script")
#print("Enter Phone Nr: (do not enter starting '0'!) Example: 798765432")
#tel_nr = int(input("+41"))
print("Enter Your Energy Registered Account Email:")
account_mail = input("Email: ")
print("Enter Your Passwort:")
account_password = input("Passwort: ")
while True:
while question_Nr < 10:
press_answer(question_Nr)
question_Nr += 1
else:
try:
win1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button game-button-slot']")[0]
win1.click()
elem2 = driver.find_elements_by_xpath("//div[@class='circle col-xs-4 col-sm-3 col-md-4 col-lg-3']")[6]
elem2.click()
try:
elem1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button btn-lg']")[0]
elem1.click()
except:
pass
except:
try:
try:
#elem3 = driver.find_elements_by_xpath("//input[@placeholder='Handynummer']")[0]
#elem3.send_keys(tel_nr)
#elem1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button btn-lg']")[0]
#elem1.click()
try:
energyLogin = driver.find_elements_by_xpath("//input[@name='email']")[0]
energyLogin.send_keys(account_mail)
elem3 = driver.find_elements_by_xpath("//button[@id='first-step-continue-btn']")[0]
elem3.click()
except:
try:
energyPass = driver.find_elements_by_xpath("//input[@name='password']")[0]
energyPass.send_keys(account_password)
elem4 = driver.find_elements_by_xpath("//button[@id='native-login-btn']")[0]
elem4.click()
except:
pass
#found_mail = False
#while found_mail is False:
# sms_code = nrg_code.main()
# if sms_code is not None:
# found_mail = True
# print(sms_code + "....................................................")
# code_numb_list = []
# for numb in sms_code:
# code_numb_list.append(numb)
# driver.find_elements_by_xpath("//input[@id='1']")[0].send_keys(code_numb_list[0])
# driver.find_elements_by_xpath("//input[@id='2']")[0].send_keys(code_numb_list[1])
# driver.find_elements_by_xpath("//input[@id='3']")[0].send_keys(code_numb_list[2])
# driver.find_elements_by_xpath("//input[@id='4']")[0].send_keys(code_numb_list[3])
# elem1 = \
# driver.find_elements_by_xpath(
# "//button[@class='btn btn-primary game-button btn-lg btn-declined']")[0]
# elem1.click()
# else:
# time.sleep(5)
except:
pass
elem1 = driver.find_elements_by_xpath("//button[@class='btn btn-primary game-button btn-lg']")[0]
elem1.click()
except:
pass
question_Nr = 0
counter += 1
print("COUNT:", counter)
if counter == 115:
driver.close()
driver = webdriver.Chrome(executable_path=r"D:\Energy-Bot-2019\chromedriver.exe")
driver.get("https://game.energy.ch/")
assert "Energy" in driver.title
counter = 0

@ -0,0 +1,19 @@
cachetools==3.1.1
certifi==2019.6.16
chardet==3.0.4
google-api-python-client==1.7.11
google-auth==1.6.3
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.0
httplib2==0.13.1
idna==2.8
oauthlib==3.1.0
pyasn1==0.4.6
pyasn1-modules==0.2.6
requests==2.22.0
requests-oauthlib==1.2.0
rsa==4.0
selenium==3.141.0
six==1.12.0
uritemplate==3.0.0
urllib3==1.25.3
Loading…
Cancel
Save