From cd712e992de6c663271d4aad95558e905eb46521 Mon Sep 17 00:00:00 2001 From: TheRaiwy Date: Fri, 10 Jul 2026 19:56:23 +0300 Subject: [PATCH] Fix cookie login: add path/secure attrs, check auth before setting --- main.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index c2fe210..25fc375 100644 --- a/main.py +++ b/main.py @@ -302,8 +302,10 @@ def save_result(acc: dict, category: str, msg: str = "") -> None: def _cookie_login(driver, cookie: str) -> bool: - driver.get("https://www.roblox.com") + driver.get("https://www.roblox.com/home") time.sleep(2) + if "/login" not in driver.current_url: + return True try: accept = WebDriverWait(driver, 3).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Accept All']"))) accept.click() @@ -311,11 +313,18 @@ def _cookie_login(driver, cookie: str) -> bool: except Exception: pass try: - driver.add_cookie({"name": ".ROBLOSECURITY", "value": cookie, "domain": ".roblox.com"}) + driver.add_cookie({ + "name": ".ROBLOSECURITY", + "value": cookie, + "domain": ".roblox.com", + "path": "/", + "secure": True, + }) driver.get("https://www.roblox.com/home") - time.sleep(3) + time.sleep(4) return "/login" not in driver.current_url - except Exception: + except Exception as e: + log.warning("Cookie login error: %s", e) return False