Spaces:
Running
Running
Upload bot.py
Browse files
bot.py
CHANGED
|
@@ -148,23 +148,25 @@ class AviatorBot:
|
|
| 148 |
"""Navigate to Aviator and find the game iframe"""
|
| 149 |
logger.info(f"Navigating to: {self.config['BASE_URL']}")
|
| 150 |
await self.page.goto(self.config['BASE_URL'], wait_until="domcontentloaded", timeout=60000)
|
| 151 |
-
logger.info("Game page loaded. Waiting
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
try:
|
| 155 |
-
# Search all frames for any spribegaming/aviator URL
|
| 156 |
for f in self.page.frames:
|
| 157 |
-
logger.
|
| 158 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
self.game_frame = f
|
| 160 |
logger.info(f"✅ Aviator iframe found: {f.url}")
|
| 161 |
return True
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
|
| 169 |
async def monitor_results(self):
|
| 170 |
"""Monitor game events by polling the DOM inside the Aviator iframe"""
|
|
|
|
| 148 |
"""Navigate to Aviator and find the game iframe"""
|
| 149 |
logger.info(f"Navigating to: {self.config['BASE_URL']}")
|
| 150 |
await self.page.goto(self.config['BASE_URL'], wait_until="domcontentloaded", timeout=60000)
|
| 151 |
+
logger.info("Game page loaded. Waiting up to 30s for game iframe to initialize...")
|
| 152 |
+
|
| 153 |
+
for _ in range(30):
|
|
|
|
|
|
|
| 154 |
for f in self.page.frames:
|
| 155 |
+
logger.debug(f" Frame URL: {f.url}")
|
| 156 |
+
if "spribe" in f.url or "aviator" in f.url:
|
| 157 |
+
# Check if it's the demo game
|
| 158 |
+
if "demo" in f.url:
|
| 159 |
+
logger.warning("⚠️ Demo game loaded instead of real game!")
|
| 160 |
+
|
| 161 |
self.game_frame = f
|
| 162 |
logger.info(f"✅ Aviator iframe found: {f.url}")
|
| 163 |
return True
|
| 164 |
+
|
| 165 |
+
# Wait 1s and check again
|
| 166 |
+
await asyncio.sleep(1)
|
| 167 |
+
|
| 168 |
+
logger.error("❌ Could not find Aviator game iframe after scanning all frames.")
|
| 169 |
+
return False
|
| 170 |
|
| 171 |
async def monitor_results(self):
|
| 172 |
"""Monitor game events by polling the DOM inside the Aviator iframe"""
|