| import websocket |
| import json |
| import time |
|
|
| def on_message(ws, message): |
| |
| messages = message.split(chr(30)) |
| for msg in messages: |
| if not msg: continue |
| try: |
| data = json.loads(msg) |
| |
| if data.get("type") == 1: |
| target = data.get("target") |
| args = data.get("arguments", []) |
| print(f"[LIVE] {target} : {args}") |
| |
| elif data.get("type") == 6: |
| ws.send('{"type":6}' + chr(30)) |
| except: |
| pass |
|
|
| def on_error(ws, error): |
| print(f"Erreur: {error}") |
|
|
| def on_close(ws, close_status_code, close_msg): |
| print("Connexion fermée") |
|
|
| def on_open(ws): |
| print("Connexion établie. Envoi du Handshake...") |
| |
| ws.send(json.dumps({"protocol": "json", "version": 1}) + chr(30)) |
| time.sleep(1) |
| |
| sub = { |
| "type": 1, |
| "target": "SubscribeToGame", |
| "arguments": ["aviator", "hg-uat4"] |
| } |
| ws.send(json.dumps(sub) + chr(30)) |
| print("Souscription envoyée. Écoute des multiplicateurs...") |
|
|
| if __name__ == "__main__": |
| url = "wss://hg-push-api-prod.sporty-tech.net/public" |
| ws = websocket.WebSocketApp(url, |
| on_open=on_open, |
| on_message=on_message, |
| on_error=on_error, |
| on_close=on_close, |
| header={"Origin: https://bet261.mg"}) |
| ws.run_forever() |
|
|