Compare commits

..

3 Commits

Author SHA1 Message Date
e1e5560256 added winningslog if luckypot was claimed in this run 2023-04-20 09:51:20 +02:00
d65dd6541b added Winnings.txt to gitignore 2023-04-08 11:16:10 +02:00
d4b0fe9e31 fixed: search honeygainlogin.json in script folder
fixed: Add your Winnings logfile to script folder
commented out the while loop for not enough traffic. (__lottie_elemtent_2" is always present)
2023-04-08 11:15:52 +02:00
2 changed files with 30 additions and 18 deletions

3
.gitignore vendored
View File

@@ -4,4 +4,5 @@ dist/
claim.log claim.log
package.sh package.sh
honeygaingift.spec honeygaingift.spec
output/ output/
Winnings.txt

View File

@@ -73,7 +73,8 @@ logger = logging.getLogger()
# Stelle das Log Level ein # Stelle das Log Level ein
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
login_file = 'honeygainlogin.json' login_file = os.path.join(script_dir, 'honeygainlogin.json')
winnings_log = os.path.join(script_dir, 'Winnings.txt')
# Lade die Logindaten aus der honeygainlogin.json datei. # Lade die Logindaten aus der honeygainlogin.json datei.
try: try:
@@ -167,19 +168,19 @@ cookie_button = driver.find_element(By.XPATH, "//button[contains(., 'Accept sele
cookie_button.click() cookie_button.click()
# Zunächst überprüfen wir, ob wir schon genug Traffic zum claimen erzeugt haben # Zunächst überprüfen wir, ob wir schon genug Traffic zum claimen erzeugt haben
while True: #while True:
try: # try:
time.sleep(5) # time.sleep(5)
traffic = driver.find_element(By.ID, "__lottie_element_2") # traffic = driver.find_element(By.ID, "__lottie_element_2")
traffic_element = driver.find_element(By.XPATH, "//span[contains(text(), 'MB')]") # traffic_element = driver.find_element(By.XPATH, "//span[contains(text(), 'MB')]")
traffic_text = traffic_element.text # traffic_text = traffic_element.text
print(f"Es wurde noch nicht genug traffic erzeugt ({traffic_text}) von 15 MB") # print(f"Es wurde noch nicht genug traffic erzeugt ({traffic_text}) von 15 MB")
print('Warte 60 Minuten und versuche es erneut') # print('Warte 60 Minuten und versuche es erneut')
time.sleep(3600) # time.sleep(3600)
driver.get(driver.current_url) # driver.get(driver.current_url)
except: # except:
# Element not found, do something else # # Element not found, do something else
break # break
# Versuche einen Timer ausfindig zu machen # Versuche einen Timer ausfindig zu machen
try: try:
@@ -214,14 +215,13 @@ try:
print('Du hast heute', winnings_str ,'Credits (', winnings_in_dollars, '$) gewonnen.') print('Du hast heute', winnings_str ,'Credits (', winnings_in_dollars, '$) gewonnen.')
winningslog = f"Es wurden {winnings_str} Credits ({winnings_in_dollars} $) gewonnen." winningslog = f"Es wurden {winnings_str} Credits ({winnings_in_dollars} $) gewonnen."
today = datetime.datetime.now().strftime("%d.%m.%Y") today = datetime.datetime.now().strftime("%d.%m.%Y")
filename = "Winnings.txt"
try: try:
with open(filename, 'r+') as file: with open(winnings_log, 'r+') as file:
contents = file.read() contents = file.read()
if today not in contents: if today not in contents:
file.write(f"{today} - {winningslog}\n") file.write(f"{today} - {winningslog}\n")
except FileNotFoundError: except FileNotFoundError:
with open(filename, 'w') as file: with open(winnings_log, 'w') as file:
file.write(f"{today} - {winningslog}\n") file.write(f"{today} - {winningslog}\n")
else: else:
print('Error:', response.status_code, response.text) print('Error:', response.status_code, response.text)
@@ -251,6 +251,17 @@ except TimeoutException:
winnings_str = str(winnings_int) winnings_str = str(winnings_int)
# Zeige eine Nachricht mit den Credits die heute gewonnen wurden. # Zeige eine Nachricht mit den Credits die heute gewonnen wurden.
print('Der LuckyPot wurde erfolgreich geclaimed! Du hast', winnings_str ,'Credits (', winnings_in_dollars, '$) gewonnen.') print('Der LuckyPot wurde erfolgreich geclaimed! Du hast', winnings_str ,'Credits (', winnings_in_dollars, '$) gewonnen.')
winningslog = f"Es wurden {winnings_str} Credits ({winnings_in_dollars} $) gewonnen."
today = datetime.datetime.now().strftime("%d.%m.%Y")
try:
with open(winnings_log, 'r+') as file:
contents = file.read()
if today not in contents:
file.write(f"{today} - {winningslog}\n")
except FileNotFoundError:
with open(winnings_log, 'w') as file:
file.write(f"{today} - {winningslog}\n")
except TimeoutException: except TimeoutException:
print("The 'Open Lucky Pot' button was not found within 10 seconds. Exiting...") print("The 'Open Lucky Pot' button was not found within 10 seconds. Exiting...")