Advertisement
coinwalk

best of snowy and benderer

Jul 7th, 2024 (edited)
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.85 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. import time
  6. import math
  7. from selenium import webdriver
  8. from selenium.webdriver.chrome.service import Service as ChromeService
  9. from selenium.webdriver.firefox.service import Service as FirefoxService
  10. from selenium.webdriver.common.by import By
  11. from selenium.webdriver.support.ui import WebDriverWait
  12. from selenium.webdriver.support import expected_conditions as EC
  13. from selenium.common.exceptions import ElementClickInterceptedException
  14.  
  15. # Set recursion limit (be cautious with very high limits)
  16. sys.setrecursionlimit(1000)
  17.  
  18. # Function to initialize WebDriver
  19. def init_driver(browser='firefox'):
  20.     if browser == 'chrome':
  21.         service = ChromeService()
  22.         options = webdriver.ChromeOptions()
  23.         driver = webdriver.Chrome(service=service, options=options)
  24.     elif browser == 'firefox':
  25.         service = FirefoxService(executable_path=r'K:\DOWNLOADS\geckodriver-v0.34.0-win32\geckodriver.exe')
  26.         options = webdriver.FirefoxOptions()
  27.         options.add_argument("--headless")
  28.         options.binary_location = r'C:\Program Files\Mozilla Firefox\firefox.exe'  # Update this path
  29.         driver = webdriver.Firefox(service=service, options=options)
  30.     else:
  31.         raise ValueError("Unsupported browser: {}".format(browser))
  32.     return driver
  33.  
  34. driver = init_driver('firefox')
  35.  
  36. try:
  37.     print("please wait loading page and login")
  38.     driver.get("https://just-dice.com")
  39.     WebDriverWait(driver, 20).until(
  40.         EC.element_to_be_clickable((By.CSS_SELECTOR, "a.fancybox-item.fancybox-close"))
  41.     ).click()
  42.  
  43.     # Wait for the overlay to disappear
  44.     WebDriverWait(driver, 10).until(
  45.         EC.invisibility_of_element_located((By.CLASS_NAME, "fancybox-overlay"))
  46.     )
  47.    
  48.     account_link = driver.find_element(By.LINK_TEXT, "Account")
  49.    
  50.     # Try clicking, with JavaScript fallback
  51.     try:
  52.         account_link.click()
  53.     except ElementClickInterceptedException:
  54.         driver.execute_script("arguments[0].click();", account_link)
  55.    
  56.     WebDriverWait(driver, 5).until(
  57.         EC.element_to_be_clickable((By.ID, "myuser"))
  58.     ).clear()
  59.    
  60.     driver.find_element(By.ID, "myuser").send_keys("username")
  61.     driver.find_element(By.ID, "mypass").clear()
  62.     driver.find_element(By.ID, "mypass").send_keys("password")
  63.     driver.find_element(By.ID, "myok").click()
  64.    
  65.     WebDriverWait(driver, 20).until(
  66.         EC.presence_of_element_located((By.ID, "pct_balance"))
  67.     )
  68.     print("logged in")
  69.    
  70.     balance = float(driver.find_element(By.ID, "pct_balance").get_attribute("value"))
  71.     base = 6e-7
  72.     fumble = base
  73.     tens = base * 10
  74.     sevens = base * 6.9
  75.     eights = base * 7.9
  76.     gold = balance
  77.     good = math.floor(gold / tens) * tens
  78.     print("should see bets")
  79.    
  80.     def go():
  81.         global base, tens, sevens, eights, fumble, good, balance
  82.         balance = float(driver.find_element(By.ID, "pct_balance").get_attribute("value"))
  83.        
  84.         if (balance > (math.floor(balance / tens) * tens + sevens) and
  85.             balance < (math.floor(balance / tens) * tens + eights)):
  86.             fumble *= 2
  87.        
  88.         if (balance >= good + tens and balance < (math.floor(balance / tens) * tens + sevens)):
  89.             fumble = base
  90.             good = math.floor(balance / tens) * tens
  91.        
  92.         number = fumble
  93.         rounded_number = f"{number:.8f}"
  94.         driver.find_element(By.ID, "pct_chance").clear()
  95.         driver.find_element(By.ID, "pct_chance").send_keys("49.5000")
  96.         driver.find_element(By.ID, "pct_bet").clear()
  97.         driver.find_element(By.ID, "pct_bet").send_keys(rounded_number)
  98.         driver.find_element(By.ID, "a_lo").click()
  99.         time.sleep(0.08)
  100.    
  101.     while True:
  102.         go()
  103.  
  104. except Exception as e:
  105.     print(f"An error occurred: {e}")
  106.  
  107. finally:
  108.     driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement