código atual:" import asyncio import json import r...

Creado el: 19 de agosto de 2025

Respondido usando GPT-5 Thinking por Chat01

Pregunta

código atual:"
import asyncio
import json
import re
from typing import Optional, Dict, Any, List, Tuple
import urllib.parse

import requests
import websockets
from playwright.async_api import async_playwright

==============================================================================

0) CONFIG – ajuste seus cookies/sessão aqui

==============================================================================

P_B_COOKIE = "fnWI711UP20Z-5hhB4qmXA%3D%3D" # obrigatório (cookie de sessão p-b)
P_LAT_COOKIE = "" # opcional
CF_CLEARANCE = "thwhcHgrOeXgMi7doUzJvgtSt5I4gzXO0m.H49jgyA0-1755601426-1.2.1.1-9uKyi3ob4O0gitbAw3w3FFJTZNDhz2lCDq.BSoTiGToSvGQ9u187hnoJSM3F7a9NAKHZS8jmqWNMxWV1zFM5umeCP7eGv8y474o4fpqWEbu.Mcmyajt6ZM10wtzkvKqmdvkTfYOW4HOZkVFxQoCjDKW9dokcRv.zhGvRA4N6li0tvYZARuAgHLx8SRmiB1jL90FI3i8x5rgxObnHHQEOX80IV7.4w1JJe6ipSveEI8w"
CF_BM = "EBefqZ01pvWR0B_MsvkraEXhpn3bBvHkAKEt9sBMJV4-1755601425-1.0.1.1-TLMm3MA2hJZrs2G94tXN7ySKgwjGLDDBj.L5EMp8LeFAPjSurFpNwRyCZgJ1Rj0hjHuTm5yxz8vKWHCB5srAqcKfO49qFPqk4fttffxLoog"
P_SB = ""

Se quiser forçar um canal específico, preencha; caso contrário será capturado

POE_TCHANNEL_FALLBACK = "poe-chan105-8888-eubnxknfqzvcppphsprm"

BOT_NAME = "GPT-5" # slug visível na URL
PROMPT = "Olá, tudo bem, qm é voce?" # mensagem a enviar

POE_URL_ROOT = "https://poe.com"
POE_API_URL = f"{POE_URL_ROOT}/api/gql_POST"

BASE_HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",
"Accept": "/",
"Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8",
"Origin": POE_URL_ROOT,
"Referer": f"{POE_URL_ROOT}/{BOT_NAME}",
"Sec-Ch-Ua": '"Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"Content-Type": "application/json",
"poegraphql": "0", # string mesmo
}

============================== UTILS =========================================

def cookie_header_from_jar(jar: requests.cookies.RequestsCookieJar) -> str:
return "; ".join(f"{c.name}={c.value}" for c in jar)

def get_tchannel_from_cookies(jar: requests.cookies.RequestsCookieJar) -> Optional[str]:
for c in jar:
name = c.name.lower()
if "tchannel" in name and "channel" in name:
return c.value
return None

def ws_url_from_tchannel(channel: str) -> str:
m = re.search(r"chan(\d+)-", channel)
if not m:
raise ValueError(f"tchannel inesperado: {channel}")
shard = m.group(1)
return f"wss://tch{shard}.poe.com/up/{channel.replace('poe-','')}/updates?channel={channel}"

def parse_cookie_header_and_set(session: requests.Session, cookie_header: str):
"""Aplica um Cookie header literal no cookie jar (para uso posterior no WS)."""
if not cookie_header:
return
parts = [p.strip() for p in cookie_header.split(";") if "=" in p]
for part in parts:
try:
k, v = part.split("=", 1)
session.cookies.set(k.strip(), v.strip(), domain="poe.com", path="/")
except Exception:
continue

-------------------- regex robustas p/ hashes em bundles ----------------------

SEND_RE = re.compile(r'"sendMessageMutation"\s*:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)
SUBS_RE = re.compile(r'"chatMessagesSubscription"\s*:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)

fallback mais frouxo (ordem diferente):

SUBS_FALLBACK = re.compile(r'chatMessagesSubscription"\s*[,:{][^"]{0,400}?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)

============================== BOOTSTRAP ======================================

async def get_bootstrap(bot_name: str, cookie_dict: Dict[str, str], prompt_for_capture: str) -> Dict[str, Optional[str]]:
"""
Abre a página logada, digita o prompt e intercepta a sendMessageMutation EXATA (headers + body RAW).
Também varre scripts (src + inline) para extrair a hash da chatMessagesSubscription.
"""
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()

text
# Injeta cookies de sessão add = [] for name in ("p-b", "p-lat", "cf_clearance", "__cf_bm", "p-sb"): val = cookie_dict.get(name) if val: add.append({"name": name, "value": val, "domain": "poe.com", "path": "/", "secure": True}) if add: await context.add_cookies(add) page = await context.new_page() await page.goto(f"{POE_URL_ROOT}/{bot_name}", wait_until="domcontentloaded") # formkey via função global ou __NEXT_DATA__ formkey = None try: formkey = await page.evaluate("window.ereNdsRqhp2Rd3LEW && window.ereNdsRqhp2Rd3LEW()") except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): try: json_text = await page.evaluate('document.getElementById("__NEXT_DATA__")?.textContent') if json_text: data = json.loads(json_text) def find_key(node, key): if isinstance(node, dict): for k, v in node.items(): if isinstance(k, str) and k.lower() == key and isinstance(v, str): return v r = find_key(v, key) if r: return r elif isinstance(node, list): for x in node: r = find_key(x, key) if r: return r return None fk2 = find_key(data, "formkey") if isinstance(fk2, str) and len(fk2) >= 32: formkey = fk2 except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): await context.close(); await browser.close() raise RuntimeError("Falha ao extrair poe-formkey.") # metas try: revision_meta = await page.evaluate('document.querySelector("meta[name=\'poe-revision\']")?.content') except Exception: revision_meta = None try: tag_id_meta = await page.evaluate('document.querySelector("meta[name=\'poe-tag-id\']")?.content') except Exception: tag_id_meta = None # ---------- função auxiliar: varrer scripts (src + inline) e achar hashes ---------- def scan_text_for_hashes(text: str) -> Tuple[Optional[str], Optional[str]]: send_hash = None subs_hash = None m1 = SEND_RE.search(text) if m1: send_hash = m1.group(1) m2 = SUBS_RE.search(text) if m2: subs_hash = m2.group(1) else: m2b = SUBS_FALLBACK.search(text) if m2b: subs_hash = m2b.group(1) return send_hash, subs_hash async def find_hashes_via_scripts() -> Tuple[Optional[str], Optional[str]]: send_hash_bundles = None subs_hash_bundles = None # 1) inline scripts try: inline_js: List[str] = await page.evaluate(""" Array.from(document.querySelectorAll('script:not([src])')) .map(s => s.textContent || '') """) except Exception: inline_js = [] for js in inline_js: s, sub = scan_text_for_hashes(js) send_hash_bundles = send_hash_bundles or s subs_hash_bundles = subs_hash_bundles or sub if send_hash_bundles and subs_hash_bundles: return send_hash_bundles, subs_hash_bundles # 2) script URLs (inclui preload) try: script_urls: List[str] = await page.evaluate(""" [ ...Array.from(document.scripts).map(s => s.src).filter(Boolean), ...Array.from(document.querySelectorAll('link[rel="preload"][as="script"]')).map(l => l.href).filter(Boolean) ] """) except Exception: script_urls = [] # normalizar e deduplicar norm_urls = [] seen = set() for u in script_urls: if not u: continue if u.startswith("/"): u = urllib.parse.urljoin(POE_URL_ROOT, u) if u in seen: continue seen.add(u) norm_urls.append(u) sess_tmp = requests.Session() for url in norm_urls: try: r = sess_tmp.get(url, timeout=15) if r.ok and "javascript" in r.headers.get("Content-Type", ""): txt = r.text s, sub = scan_text_for_hashes(txt) send_hash_bundles = send_hash_bundles or s subs_hash_bundles = subs_hash_bundles or sub if send_hash_bundles and subs_hash_bundles: break except Exception: continue return send_hash_bundles, subs_hash_bundles # primeira tentativa de achar hashes (antes de digitar o prompt) send_hash_bundles, subs_hash_bundles = await find_hashes_via_scripts() # Intercepta a sendMessageMutation (headers + body RAW) — e NÃO envia de verdade captured = { "payload_dict": None, "payload_raw": None, "hash": None, "req_headers": {}, "tag_id_hdr": None, "tchannel_hdr": None, "cookie_header": None, "revision_hdr": None, "formkey_hdr": None, } async def route_handler(route, request): try: if request.url.endswith("/api/gql_POST"): hdrs = {k.lower(): v for k, v in request.headers.items()} body = request.post_data or "" qn = hdrs.get("poe-queryname", "") if qn == "sendMessageMutation" or "sendMessageMutation" in (body or ""): captured["req_headers"] = {**captured["req_headers"], **hdrs} captured["payload_raw"] = body if "cookie" in hdrs: captured["cookie_header"] = hdrs["cookie"] if "poe-revision" in hdrs: captured["revision_hdr"] = hdrs["poe-revision"] if "poe-formkey" in hdrs: captured["formkey_hdr"] = hdrs["poe-formkey"] if "poe-tchannel" in hdrs: captured["tchannel_hdr"] = hdrs["poe-tchannel"] if "poe-tag-id" in hdrs: captured["tag_id_hdr"] = hdrs["poe-tag-id"] try: payload = json.loads(body) captured["payload_dict"] = payload captured["hash"] = (payload.get("extensions") or {}).get("hash") except Exception: pass # NÃO enviar de verdade — simulamos 200 e guardamos cópia fiel await route.fulfill(status=200, content_type="application/json", body='{"data":{"messageCreate":null}}') return except Exception: pass await route.continue_() await page.route("**/api/gql_POST", route_handler) # Digita o prompt real e "envia" (será fulfiled acima) try: locator = page.locator("textarea") if await locator.count() > 0: ta = locator.first await ta.click() await ta.fill(prompt_for_capture) else: ed = page.locator('div[contenteditable="true"]').first await ed.click() await ed.fill(prompt_for_capture) await page.keyboard.press("Enter") except Exception: pass # Aguarda captura do body (até ~20s) for _ in range(100): if captured["payload_raw"]: break await page.wait_for_timeout(200) # segunda tentativa de achar a subs hash (scripts podem carregar tardiamente) if not subs_hash_bundles: s2, sub2 = await find_hashes_via_scripts() send_hash_bundles = send_hash_bundles or s2 subs_hash_bundles = subs_hash_bundles or sub2 try: await page.unroute("**/api/gql_POST", route_handler) except Exception: pass await context.close(); await browser.close() # Preferências finais final_formkey = captured["formkey_hdr"] or formkey final_revision = captured["revision_hdr"] or revision_meta final_tag_id = captured["tag_id_hdr"] or tag_id_meta final_tchannel = captured["tchannel_hdr"] payload_dict = captured["payload_dict"] payload_raw = captured["payload_raw"] hash_intercept = captured["hash"] if not payload_raw: raise RuntimeError("Não foi possível capturar a sendMessageMutation (body RAW) para o prompt fornecido.") return { "formkey": final_formkey, "revision": final_revision, "send_hash": (hash_intercept or send_hash_bundles), "sub_hash": subs_hash_bundles, # <- obtido de bundles/inline com regex robusta "tag_id": final_tag_id, "tchannel_hdr": final_tchannel, "cookie_header": captured["cookie_header"], "payload_base": payload_dict, # JSON parseado (apenas para log) "payload_raw": payload_raw, # BODY STRING EXATA (usar no POST) "req_headers": captured["req_headers"] or {}, # HEADERS EXATOS (lowercase) }

============================== STREAM PARSING =================================

def extract_text_pieces(event: Any) -> List[str]:
out: List[str] = []
if isinstance(event, dict):
for k in ("text_new", "response", "delta", "text"):
v = event.get(k)
if isinstance(v, str) and v:
out.append(v)
for v in event.values():
if isinstance(v, (dict, list)):
out.extend(extract_text_pieces(v))
elif isinstance(event, list):
for x in event:
out.extend(extract_text_pieces(x))
return out

def is_final_event(event: Dict[str, Any]) -> bool:
data = event.get("data") or {}
cat = (event.get("category") or "").lower()
state = (data.get("state") or data.get("message_state") or "").lower()
if "completed" in cat:
return True
if state in {"complete", "completed", "stopped", "aborted"}:
return True
if data.get("is_final") is True:
return True
return False

============================== RECEPÇÃO VIA WS =================================

async def listen_via_websocket(chat_id: str, session: requests.Session, subscription_hash: str) -> str:
tchannel = session.headers.get("poe-tchannel") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK
if not tchannel:
raise RuntimeError("Sem poe-tchannel (cookie/forçado).")

text
# Monta URL do WS m = re.search(r"chan(\d+)-", tchannel) if not m: raise RuntimeError(f"tchannel inesperado: {tchannel}") shard = m.group(1) ws_url = f"wss://tch{shard}.poe.com/up/{tchannel.replace('poe-','')}/updates?channel={tchannel}" ws_headers = dict(BASE_HEADERS) ws_headers["poe-tchannel"] = tchannel ws_headers["Cookie"] = cookie_header_from_jar(session.cookies) # Assina explicitamente a subscription p/ ESTE chatId real payload = { "type": "subscriptions", "subscriptions": { f"chatMessages_0_{chat_id}": { "queryName": "chatMessagesSubscription", "variables": {"chatId": chat_id}, "hash": subscription_hash, } } } full = "" async with websockets.connect(ws_url, extra_headers=ws_headers, max_size=None) as ws: await ws.send(json.dumps(payload)) async for message in ws: data = json.loads(message) if data.get("mtype") == "subscriptionUpdate": for p in data.get("payload", {}).get("payloads", []): new = p.get("data", {}).get("messageAdded") if not new: continue piece = new.get("text_new") or "" if piece: print(piece, end="", flush=True) full += piece if (new.get("state") or "").lower() in {"complete", "completed"}: print("\n--- Resposta Completa (WS) ---") return full return full

============================== DIAGNÓSTICO ====================================

def summarize_payload_and_headers(payload_base: Dict[str, Any], req_headers: Dict[str, str]) -> Tuple[str, str]:
vars_obj = (payload_base or {}).get("variables") or {}
exts_obj = (payload_base or {}).get("extensions") or {}
sdid = vars_obj.get("sdid")
bot = vars_obj.get("bot")
hashv = exts_obj.get("hash")
hsum = f"bot:{str(bot)[:12]}… sdid:{str(sdid)[:12]}… hash:{str(hashv)[:8]}…"
krit = {k: req_headers.get(k) for k in ["poe-formkey", "poe-revision", "poe-tag-id", "poe-tchannel", "poe-queryname", "poegraphql"]}
ksum = " ".join(f"{k.split('-')[1] if k.startswith('poe-') else k}:{(v[:12]+'…') if isinstance(v, str) and len(v)>14 else v}" for k, v in krit.items())
return hsum, ksum

================================= MAIN ========================================

async def main():
session = requests.Session()
session.headers.update(BASE_HEADERS)

text
# Cookies base no jar (para WS posteriormente) session.cookies.update({"p-b": P_B_COOKIE}) if P_LAT_COOKIE: session.cookies.set("p-lat", P_LAT_COOKIE, domain="poe.com", path="/") if CF_CLEARANCE: session.cookies.set("cf_clearance", CF_CLEARANCE, domain="poe.com", path="/") if CF_BM: session.cookies.set("__cf_bm", CF_BM, domain="poe.com", path="/") if P_SB: session.cookies.set("p-sb", P_SB, domain="poe.com", path="/") try: # 1) Captura 1:1 e sub_hash via bundles/inline info = await get_bootstrap( BOT_NAME, {"p-b": P_B_COOKIE, "p-lat": P_LAT_COOKIE, "cf_clearance": CF_CLEARANCE, "__cf_bm": CF_BM, "p-sb": P_SB}, PROMPT, ) payload_raw = info.get("payload_raw") # STRING exata payload_capturado = info.get("payload_base") # JSON (apenas para log) req_headers_cap = {k.lower(): v for k, v in (info.get("req_headers") or {}).items()} subs_hash = info.get("sub_hash") if not payload_raw: raise RuntimeError("Não capturei a sendMessageMutation (body RAW).") if not subs_hash or not re.fullmatch(r"[0-9a-f]{64}", subs_hash): raise RuntimeError("Não foi possível extrair a hash de chatMessagesSubscription dos bundles/inline.") # Cookies exatos do intercept no jar (para WS) captured_cookie_header = info.get("cookie_header") or "" parse_cookie_header_and_set(session, captured_cookie_header) # Headers críticos de sessão para WS formkey = info.get("formkey") revision = info.get("revision") tchannel = info.get("tchannel_hdr") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK if formkey: session.headers["poe-formkey"] = formkey if revision: session.headers["poe-revision"] = revision if tchannel: session.headers["poe-tchannel"] = tchannel session.cookies.set("poe-tchannel-channel", tchannel, domain="poe.com", path="/") # LOG p_sum, h_sum = summarize_payload_and_headers(payload_capturado or {}, req_headers_cap) tch_cookie = get_tchannel_from_cookies(session.cookies) or "n/a" print( f"formkey:{(formkey or '')[:6]}… tag_hdr:{(info.get('tag_id') or '')[:8]}… " f"tchannel_hdr:{(tchannel or '')[:18]}… tchannel_cookie:{tch_cookie[:18]}… " f"sub_hash:{(subs_hash or 'n/a')[:8]}… revision:{(revision or 'n/a')[:10]}…" ) print("payload_base:", p_sum) print("req_hdrs:", h_sum) # 2) Envio 1:1 — headers quase idênticos + body RAW + Cookie literal print("\nEnviando a pergunta via GraphQL com payload/headers CAPTURADOS…") blocked = {"content-length", "host", "connection", "accept-encoding"} gql_headers = {k: v for k, v in req_headers_cap.items() if k not in blocked} gql_headers["content-type"] = "application/json" gql_headers["referer"] = f"{POE_URL_ROOT}/{BOT_NAME}" gql_headers["origin"] = POE_URL_ROOT if captured_cookie_header: gql_headers["cookie"] = captured_cookie_header resp = session.post(POE_API_URL, data=payload_raw, headers=gql_headers) if "poe-tchannel" in resp.headers: session.headers["poe-tchannel"] = resp.headers["poe-tchannel"] resp.raise_for_status() data = resp.json() root = data.get("data", {}) if isinstance(data, dict) else {} chat = None if "messageCreate" in root: chat = (root.get("messageCreate") or {}).get("chat") or {} elif "messageEdgeCreate" in root: chat = (root.get("messageEdgeCreate") or {}).get("chat") or {} if not chat: raise RuntimeError("Resposta sem objeto 'chat' esperado (messageCreate/messageEdgeCreate).") chat_id = chat.get("chatId") or chat.get("id") if not chat_id: raise RuntimeError("Não consegui obter o chatId.") print(f"Chat criado! ID: {chat_id}") # 3) Recepção via WS (sem receive_POST) final_answer = await listen_via_websocket(str(chat_id), session, subs_hash) print("\nRESPOSTA FINAL:") print(final_answer) except requests.HTTPError as e: body = getattr(e.response, "text", "")[:2000] print(f"HTTPError: {e}\nBody: {body}") except Exception as e: print(f"Erro: {e}")

if name == "main":
asyncio.run(main())" erro: Erro: Não foi possível extrair a hash de chatMessagesSubscription dos bundles/inline. (Obs: Ele envia a pergunta certinho, aparece no site do Poe, ele só não manda a resposta. Requests: gql_post: curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useMentionedBotsInputsQuery'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: c7d7d766647f5ac02349392861e63e07'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useMentionedBotsInputsQuery","variables":{"chatCode":"","hasChat":false,"fullChatInput":"Oi","currentPartialHandle":""},"extensions":{"hash":"6fb81c76162cce33770988fd687dd93feb357cb4c1ae82a6340279659dcc28aa"}}' ;
curl 'https://api.sprig.com/sdk/1/visitors/8c3e0461-99e9-4da5-8d11-05e9bb71d923/events'
-X 'OPTIONS'
-H 'Accept: /'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Access-Control-Request-Headers: authorization,content-type,sprig-modules,userleap-platform,x-ul-environment-id,x-ul-installation-method,x-ul-sdk-version,x-ul-user-id,x-ul-visitor-id'
-H 'Access-Control-Request-Method: POST'
-H 'Connection: keep-alive'
-H 'Origin: https://poe.com'
-H 'Referer: https://poe.com/'
-H 'Sec-Fetch-Dest: empty'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Site: cross-site'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://api.sprig.com/sdk/1/visitors/8c3e0461-99e9-4da5-8d11-05e9bb71d923/events'
-H 'Accept: /'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Authorization: Bearer tokenNotNeeded'
-H 'Connection: keep-alive'
-H 'Content-Type: application/json'
-H 'Origin: https://poe.com'
-H 'Referer: https://poe.com/'
-H 'Sec-Fetch-Dest: empty'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Site: cross-site'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sprig-modules: replay'
-H 'userleap-platform: web'
-H 'x-ul-environment-id: OFiT3eT6FKrU'
-H 'x-ul-installation-method: web-npm'
-H 'x-ul-sdk-version: 2.32.6'
-H 'x-ul-user-id: 3059850752'
-H 'x-ul-visitor-id: 8c3e0461-99e9-4da5-8d11-05e9bb71d923'
--data-raw '{"event":"send_chat_clicked","metadata":{"url":"https://poe.com/GPT-5"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: sendMessageMutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 773e7ec94f4ddfc3f847da29c0445a86'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 0'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"sendMessageMutation","variables":{"chatId":null,"bot":"GPT-5","query":"Oi","source":{"sourceType":"chat_input","chatInputMetadata":{"useVoiceRecord":false}},"clientNonce":"snS4GLDZiLCQO63D","sdid":"48ec8f8e-87b1-41bd-8217-7536bfea2651","attachments":[],"existingMessageAttachmentsIds":[],"shouldFetchChat":true,"referencedMessageId":null,"parameters":null,"fileHashJwts":[]},"extensions":{"hash":"c877ecaabad9cc7bf70f5aef44aafc65b0ac9b4b13abcc15464aee443d482f41"}}' ;
curl 'https://poe.com/_next/data/ebEA6gpl4YNSdJBXpsOkR/chat/s6c9q90y5f8i1q6jvz.json?chat=s6c9q90y5f8i1q6jvz'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'priority: u=1, i'
-H 'purpose: prefetch'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'x-middleware-prefetch: 1'
-H 'x-nextjs-data: 1' ;
curl 'https://www.facebook.com/tr/?id=1611526079610489&ev=PageView&dl=https%3A%2F%2Fpoe.com%2Fchat%2Fs6c9q90y5f8i1q6jvz&rl=&if=false&ts=1755604917165&sw=1600&sh=900&v=2.9.224&r=stable&ec=7&o=4126&fbp=fb.1.1755600520633.6733147262899197&ler=empty&pmd$$title$$=GPT-5%20-%20Poe&plt=467.70000000018626&it=1755604819902&coo=false&exp=u3&rqm=GET' -H 'Referer: https://poe.com/' ;
curl 'https://www.facebook.com/privacy_sandbox/pixel/register/trigger/?id=1611526079610489&ev=PageView&dl=https%3A%2F%2Fpoe.com%2Fchat%2Fs6c9q90y5f8i1q6jvz&rl=&if=false&ts=1755604917165&sw=1600&sh=900&v=2.9.224&r=stable&ec=7&o=4126&fbp=fb.1.1755600520633.6733147262899197&ler=empty&pmd$$title$$=GPT-5%20-%20Poe&plt=467.70000000018626&it=1755604819902&coo=false&exp=u3&rqm=FGET' -H 'Referer: https://poe.com/' ;
curl 'https://poe.com/apple-touch-icon.png'
-H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/;q=0.8'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'if-modified-since: Fri, 31 Jan 2025 10:05:04 GMT'
-H 'if-none-match: W/"19e9-194bbd23880"'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: image'
-H 'sec-fetch-mode: no-cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: f9a87aa12a736ff4e69a744fc4e50104'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation","variables":{"chatId":1248142311},"extensions":{"hash":"dcfc17acd2ec0bbd1525fd786ead7689d8c6201c59300c31f2d5d335984689db"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: ChatLastMessageAreaQuery'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 42417f2d16f038076690790a22ed689b'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"ChatLastMessageAreaQuery","variables":{"messageNodeId":"TWVzc2FnZTo0MjM0ODk3NDY5MTk=","chatNodeId":"Q2hhdDoxMjQ4MTQyMzEx"},"extensions":{"hash":"dcf4b7a90ee6728a544c4225bdb531b6ad33ab2a8e0e545680406f3ba115fb67"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: f9a87aa12a736ff4e69a744fc4e50104'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation","variables":{"chatId":1248142311},"extensions":{"hash":"dcfc17acd2ec0bbd1525fd786ead7689d8c6201c59300c31f2d5d335984689db"}}' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: fb9106d6ac14216c79e1493c8a106c0a'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.nonce_e2e.added","value":1,"extra_data":{"socketState":"open","channel":"poe-chan105-8888-eubnxknfqzvcppphsprm"},"timeout":false,"hidden":false}},{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.nonce_e2e.cleared","value":1,"extra_data":{"socketState":"open","channel":"poe-chan105-8888-eubnxknfqzvcppphsprm","lastPongMessageReceivedTime":97564.8999999999,"elapsedTimeFromLastPongMessage":736.6000000000931,"timeSpent":903.1000000000931,"hidden":false}}},{"category":"poe/statsd_event","data":{"key":"poe.message.mutation.sendMessageMutation.http_status.200","value":1,"category":"count","extra_data":{}}},{"category":"poe/statsd_event","data":{"key":"poe.speed.web_vitals.next_render","value":99.60000000009313,"category":"time","path":"/[handle]","extra_data":{"initial_page":"/","page":"/[handle]"}}},{"category":"poe/statsd_event","data":{"key":"poe.speed.web_vitals.next_route_change_to_render","value":4.600000000093132,"category":"time","path":"/[handle]","extra_data":{"initial_page":"/","page":"/[handle]"}}},{"category":"poe/page_load","data":{"url":"/chat/s6c9q90y5f8i1q6jvz","pathname":"/[handle]","navigationType":"SPA","timingData":{"pageLoad":131.5},"previousUrl":"/GPT-5"}},{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.heartbeat.complete","value":1,"extra_data":{"messageId":"423489746919"}}},{"category":"poe/bot_response_speed","data":{"bot_name":"gpt_o4_alpha","time_to_first_typing_indicator":1107,"time_to_first_subscription_response":1786,"time_to_full_bot_response":3025,"full_response_length":32,"full_response_word_count":6,"human_message_id":423489703911,"bot_message_id":423489746919,"chat_id":"OPTIMISTIC_CHAT_619358004","bot_response_status":"success"}}]' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-5902949-200-tqimwapupgzbprlyuevlrrtjjztgxwjx.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-6016640-200-irbkrlomkjottobohlbjiorkxjwzvqan.jpeg'
-H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/
,/;q=0.8'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b '__cf_bm=zTTh0spS2Ab2gY.Go8oV_yFijbpsik6RKcvPN5GJZkU-1755604813-1.0.1.1-YHbKvYXfa1SJ7JWFVO7FMQxvVO0fT_OkhzYLd5ywtaS5o1qyV2J4A.eWmjPDzwEYAbDCqtLC_iAMqoUKW4j.FruXoluVYjTQpyam06.TBZ4'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: image'
-H 'sec-fetch-mode: no-cors'
-H 'sec-fetch-site: cross-site'
-H 'sec-fetch-storage-access: active'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-3037-200-ugzqbmdibsoxojbdujllgcuaiurzwxfn.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-5176044-200-ixsrhozcvbrhrvwgdxghshtrqpjjashv.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 1e0794f2d4ba742829a6887b22196867'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"count","key":"poe.job.heartbeat.complete","value":1,"extra_data":{"jobId":"6582189553","heartbeatHistory":"sendMessage:not_started, jobStarted:not_started, jobUpdated:not_started, jobUpdated:completed","source":"jobUpdated","jobState":"completed"}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":0}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":1}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":2}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":3}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":1806,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":4}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":2015,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":5}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":2288,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":6}}}]' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 5f5c1eaf6b564c0e5f1a55128939e700'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.full_list","value":2288,"extra_data":{"messageId":423489746919}}}]' e receive_post: curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useMentionedBotsInputsQuery'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: c7d7d766647f5ac02349392861e63e07'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useMentionedBotsInputsQuery","variables":{"chatCode":"","hasChat":false,"fullChatInput":"Oi","currentPartialHandle":""},"extensions":{"hash":"6fb81c76162cce33770988fd687dd93feb357cb4c1ae82a6340279659dcc28aa"}}' ;
curl 'https://api.sprig.com/sdk/1/visitors/8c3e0461-99e9-4da5-8d11-05e9bb71d923/events'
-X 'OPTIONS'
-H 'Accept: /'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Access-Control-Request-Headers: authorization,content-type,sprig-modules,userleap-platform,x-ul-environment-id,x-ul-installation-method,x-ul-sdk-version,x-ul-user-id,x-ul-visitor-id'
-H 'Access-Control-Request-Method: POST'
-H 'Connection: keep-alive'
-H 'Origin: https://poe.com'
-H 'Referer: https://poe.com/'
-H 'Sec-Fetch-Dest: empty'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Site: cross-site'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://api.sprig.com/sdk/1/visitors/8c3e0461-99e9-4da5-8d11-05e9bb71d923/events'
-H 'Accept: /'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Authorization: Bearer tokenNotNeeded'
-H 'Connection: keep-alive'
-H 'Content-Type: application/json'
-H 'Origin: https://poe.com'
-H 'Referer: https://poe.com/'
-H 'Sec-Fetch-Dest: empty'
-H 'Sec-Fetch-Mode: cors'
-H 'Sec-Fetch-Site: cross-site'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sprig-modules: replay'
-H 'userleap-platform: web'
-H 'x-ul-environment-id: OFiT3eT6FKrU'
-H 'x-ul-installation-method: web-npm'
-H 'x-ul-sdk-version: 2.32.6'
-H 'x-ul-user-id: 3059850752'
-H 'x-ul-visitor-id: 8c3e0461-99e9-4da5-8d11-05e9bb71d923'
--data-raw '{"event":"send_chat_clicked","metadata":{"url":"https://poe.com/GPT-5"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: sendMessageMutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 773e7ec94f4ddfc3f847da29c0445a86'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 0'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"sendMessageMutation","variables":{"chatId":null,"bot":"GPT-5","query":"Oi","source":{"sourceType":"chat_input","chatInputMetadata":{"useVoiceRecord":false}},"clientNonce":"snS4GLDZiLCQO63D","sdid":"48ec8f8e-87b1-41bd-8217-7536bfea2651","attachments":[],"existingMessageAttachmentsIds":[],"shouldFetchChat":true,"referencedMessageId":null,"parameters":null,"fileHashJwts":[]},"extensions":{"hash":"c877ecaabad9cc7bf70f5aef44aafc65b0ac9b4b13abcc15464aee443d482f41"}}' ;
curl 'https://poe.com/_next/data/ebEA6gpl4YNSdJBXpsOkR/chat/s6c9q90y5f8i1q6jvz.json?chat=s6c9q90y5f8i1q6jvz'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'priority: u=1, i'
-H 'purpose: prefetch'
-H 'referer: https://poe.com/GPT-5'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'x-middleware-prefetch: 1'
-H 'x-nextjs-data: 1' ;
curl 'https://www.facebook.com/tr/?id=1611526079610489&ev=PageView&dl=https%3A%2F%2Fpoe.com%2Fchat%2Fs6c9q90y5f8i1q6jvz&rl=&if=false&ts=1755604917165&sw=1600&sh=900&v=2.9.224&r=stable&ec=7&o=4126&fbp=fb.1.1755600520633.6733147262899197&ler=empty&pmd$$title$$=GPT-5%20-%20Poe&plt=467.70000000018626&it=1755604819902&coo=false&exp=u3&rqm=GET' -H 'Referer: https://poe.com/' ;
curl 'https://www.facebook.com/privacy_sandbox/pixel/register/trigger/?id=1611526079610489&ev=PageView&dl=https%3A%2F%2Fpoe.com%2Fchat%2Fs6c9q90y5f8i1q6jvz&rl=&if=false&ts=1755604917165&sw=1600&sh=900&v=2.9.224&r=stable&ec=7&o=4126&fbp=fb.1.1755600520633.6733147262899197&ler=empty&pmd$$title$$=GPT-5%20-%20Poe&plt=467.70000000018626&it=1755604819902&coo=false&exp=u3&rqm=FGET' -H 'Referer: https://poe.com/' ;
curl 'https://poe.com/apple-touch-icon.png'
-H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/;q=0.8'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'if-modified-since: Fri, 31 Jan 2025 10:05:04 GMT'
-H 'if-none-match: W/"19e9-194bbd23880"'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: image'
-H 'sec-fetch-mode: no-cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: f9a87aa12a736ff4e69a744fc4e50104'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation","variables":{"chatId":1248142311},"extensions":{"hash":"dcfc17acd2ec0bbd1525fd786ead7689d8c6201c59300c31f2d5d335984689db"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: ChatLastMessageAreaQuery'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 42417f2d16f038076690790a22ed689b'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"ChatLastMessageAreaQuery","variables":{"messageNodeId":"TWVzc2FnZTo0MjM0ODk3NDY5MTk=","chatNodeId":"Q2hhdDoxMjQ4MTQyMzEx"},"extensions":{"hash":"dcf4b7a90ee6728a544c4225bdb531b6ad33ab2a8e0e545680406f3ba115fb67"}}' ;
curl 'https://poe.com/api/gql_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-queryname: useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: f9a87aa12a736ff4e69a744fc4e50104'
-H 'poe-tchannel: poe-chan105-8888-eubnxknfqzvcppphsprm'
-H 'poegraphql: 1'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '{"queryName":"useChatLastMessageImpressionTracker_ChatMarkAsSeen_Mutation","variables":{"chatId":1248142311},"extensions":{"hash":"dcfc17acd2ec0bbd1525fd786ead7689d8c6201c59300c31f2d5d335984689db"}}' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: fb9106d6ac14216c79e1493c8a106c0a'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.nonce_e2e.added","value":1,"extra_data":{"socketState":"open","channel":"poe-chan105-8888-eubnxknfqzvcppphsprm"},"timeout":false,"hidden":false}},{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.nonce_e2e.cleared","value":1,"extra_data":{"socketState":"open","channel":"poe-chan105-8888-eubnxknfqzvcppphsprm","lastPongMessageReceivedTime":97564.8999999999,"elapsedTimeFromLastPongMessage":736.6000000000931,"timeSpent":903.1000000000931,"hidden":false}}},{"category":"poe/statsd_event","data":{"key":"poe.message.mutation.sendMessageMutation.http_status.200","value":1,"category":"count","extra_data":{}}},{"category":"poe/statsd_event","data":{"key":"poe.speed.web_vitals.next_render","value":99.60000000009313,"category":"time","path":"/[handle]","extra_data":{"initial_page":"/","page":"/[handle]"}}},{"category":"poe/statsd_event","data":{"key":"poe.speed.web_vitals.next_route_change_to_render","value":4.600000000093132,"category":"time","path":"/[handle]","extra_data":{"initial_page":"/","page":"/[handle]"}}},{"category":"poe/page_load","data":{"url":"/chat/s6c9q90y5f8i1q6jvz","pathname":"/[handle]","navigationType":"SPA","timingData":{"pageLoad":131.5},"previousUrl":"/GPT-5"}},{"category":"poe/statsd_event","data":{"category":"count","key":"poe.message.heartbeat.complete","value":1,"extra_data":{"messageId":"423489746919"}}},{"category":"poe/bot_response_speed","data":{"bot_name":"gpt_o4_alpha","time_to_first_typing_indicator":1107,"time_to_first_subscription_response":1786,"time_to_full_bot_response":3025,"full_response_length":32,"full_response_word_count":6,"human_message_id":423489703911,"bot_message_id":423489746919,"chat_id":"OPTIMISTIC_CHAT_619358004","bot_response_status":"success"}}]' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-5902949-200-tqimwapupgzbprlyuevlrrtjjztgxwjx.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-6016640-200-irbkrlomkjottobohlbjiorkxjwzvqan.jpeg'
-H 'accept: image/avif,image/webp,image/apng,image/svg+xml,image/
,/;q=0.8'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-b '__cf_bm=zTTh0spS2Ab2gY.Go8oV_yFijbpsik6RKcvPN5GJZkU-1755604813-1.0.1.1-YHbKvYXfa1SJ7JWFVO7FMQxvVO0fT_OkhzYLd5ywtaS5o1qyV2J4A.eWmjPDzwEYAbDCqtLC_iAMqoUKW4j.FruXoluVYjTQpyam06.TBZ4'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: image'
-H 'sec-fetch-mode: no-cors'
-H 'sec-fetch-site: cross-site'
-H 'sec-fetch-storage-access: active'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-3037-200-ugzqbmdibsoxojbdujllgcuaiurzwxfn.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://qph.cf2.poecdn.net/main-thumb-pb-5176044-200-ixsrhozcvbrhrvwgdxghshtrqpjjashv.jpeg'
-H 'sec-ch-ua-platform: "Windows"'
-H 'Referer: https://poe.com/'
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 1e0794f2d4ba742829a6887b22196867'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"count","key":"poe.job.heartbeat.complete","value":1,"extra_data":{"jobId":"6582189553","heartbeatHistory":"sendMessage:not_started, jobStarted:not_started, jobUpdated:not_started, jobUpdated:completed","source":"jobUpdated","jobState":"completed"}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":0}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":1}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":2}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":779,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":3}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":1806,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":4}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":2015,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":5}}},{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.item","value":2288,"extra_data":{"followupAction":"SendMessageFollowupAction","messageId":423489746919,"index":6}}}]' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 5f5c1eaf6b564c0e5f1a55128939e700'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"category":"time","key":"poe.speed.product.follow_up_action.full_list","value":2288,"extra_data":{"messageId":423489746919}}}]' ;
curl 'https://poe.com/api/receive_POST'
-H 'accept: /'
-H 'accept-language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'content-type: application/json'
-b 'p-b=fnWI711UP20Z-5hhB4qmXA%3D%3D; _gcl_au=1.1.1600208785.1755600520; _fbp=fb.1.1755600520633.6733147262899197; poe-tchannel-channel=poe-chan105-8888-eubnxknfqzvcppphsprm; __cf_bm=9.ziaUa7Btf9RweEUT7kCVtfr7dZI9zEsIoJN1IIcJg-1755604813-1.0.1.1-O4_DmjxQTolJNc7dqUFxl9U3pACkbhMf1tskMa7rpiTB9NQ8k1r3FWMDdkro6bEf_EHw719TIa8ZcmacDq4blaZ7w2CablfU9wHRlHf2NUQ; cf_clearance=d0AcDzKgi8JZPbSfEQGAP22Bha4pA_n_ldQmR3NI35c-1755604814-1.2.1.1-rsftTtkQVsftEyQ7ZXiq1XnESX5XvFoKILhrlFJ9C2GKIHLLB_hZeaWSlbpicZ1DBu4zz8HC_I6b1O7t5deLTaAq7Vs0Bmr8hQb.NNMhe3T9y1CCBEc09pzcTmqHqDR11PSE5bDaOQR0xiuej6QbNZWWr12ekt4.5u.ty9ynYoQ9MTHbGTV4bKxmJ4dyKB9nDgbAXPIr4O0P9mP3VavPjdSM4RTIfN.dqYbtL2iI6Bo; OptanonAlertBoxClosed=2025-08-19T12:00:19.982Z; OptanonConsent=isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A00%3A20+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC'
-H 'origin: https://poe.com'
-H 'poe-formkey: 16318c91334ce2978bb3b21e7c18d684'
-H 'poe-revision: e2acc7025b43e08e88164ba8105273f37fbeaa26'
-H 'poe-tag-id: 1063bc66a7b9187576225e7a88dbf9aa'
-H 'priority: u=1, i'
-H 'referer: https://poe.com/chat/s6c9q90y5f8i1q6jvz'
-H 'sec-ch-ua: "Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"'
-H 'sec-ch-ua-mobile: ?0'
-H 'sec-ch-ua-platform: "Windows"'
-H 'sec-fetch-dest: empty'
-H 'sec-fetch-mode: cors'
-H 'sec-fetch-site: same-origin'
-H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
--data-raw '[{"category":"poe/statsd_event","data":{"key":"poe.speed.web_vitals.INP","value":64,"category":"time","path":"/","extra_data":{}}}]'

Pensamiento

Troubleshooting subscription hash retrieval

It looks like the regex pattern isn’t matching the subscription names due to potential changes like minified code or different quoting orders. I'll adjust the patterns to check for variations like 'chatMessagesSubscription' or 'chatPageUpdatesSubscription'. Another possibility is sniffing WebSocket messages or intercepting the page’s fetch requests for 'graphqllive'.

Improving subscription hash retrieval

The code currently intercepts '/api/gql_POST' but might be missing subscription handshakes, which could be on separate endpoints like '/api/gql_SUBSCRIPTIONS'. They need to expand their search to include inline JSON or the 'NEXT_DATA' object to find 'chatMessagesSubscription' and extract its 'hash'. The prefetching network logs might also contain relevant subscription data for SSR.

Considering polling vs. websockets

Instead of relying on websockets, we could use polling with GraphQL queries like 'ChatLastMessageAreaQuery' and 'ChatQuery' to fetch message content. The logs show how messages are retrieved after 'sendMessageMutation', so we could poll to get bot responses. I'll also adjust the regex logic to handle various subscription names.

Improving subscription detection

Instead of just searching for fixed subscription names, I can make the approach more dynamic. By scanning for any 'Subscription' with a matching hash pattern, and filtering out those related to "chatId", it'll become more robust. We could also intercept the page's streaming websocket traffic to gather subscription details.

Providing robust subscription sniffing

To track subscriptions, Playwright's API lets us capture WebSocket frames, including the 'subscriptions' messages. By listening for websockets and parsing the message payload, we can extract the needed "chat" subscriptions. Alternatively, we could fall back to polling with persisted queries. I'll implement a flexible scanning system to handle changes in subscriptions, including using regex to dynamically detect them. This avoids brittle, hardcoded names.

Improving subscription handling

To handle subscriptions, I added some generic scanning and WebSocket sniffing. Specifically, I'll first capture the hash and query name from WebSocket frames. If WebSocket data isn't available, the fallback regex will scan through the scripts. Then, I'll adjust the function's signature to account for dynamic query names and variables while ensuring robust handling of chat ID. This approach avoids the failing regex tied to old names. I’ll also craft a patch to implement these changes.

Thought for 3m 27s

Respuesta

Valeu por colar todo o log — isso ajuda MUITO. O que está quebrando no seu fluxo é a descoberta da hash da subscription. O Poe vem trocando o nome e/ou a forma da subscription (antes “chatMessagesSubscription”), então sua regex rígida não encontra mais nada e você fica sem sub_hash — daí o seu WS conecta, mas nunca assina o feed certo e não chega resposta.

A boa notícia: dá pra tornar isso resiliente de duas formas. Recomendo aplicar as duas (A + B) — a B captura exatamente o que o site usa naquele momento e a A serve de fallback.


A) Regex genérica que pega qualquer *Subscription (fallback rápido)

Troque as suas regex por uma que:

  1. casa qualquer nome que termine com “Subscription”;
  2. captura o hash de 64 hex;
  3. escolhe “o melhor candidato” por heurística (nomes com “chat”, “message”, “update”).
python
# -------------------- regex mais robusta p/ subscriptions ---------------------- SEND_RE = re.compile( r'"sendMessageMutation"\s*:\s*\{[^}]*?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL ) # genérica: qualquer AlgoSubscription + hash SUBS_ANY = re.compile( r'"([A-Za-z0-9_]*Subscription)"\s*:\s*\{[^}]*?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL ) # (opcional) seu fallback bem frouxo continua valendo SUBS_FALLBACK = re.compile( r'Subscription"\s*[,:\{][^"]{0,400}?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL ) def pick_best_subscription(candidates: List[Tuple[str, str]]) -> Tuple[Optional[str], Optional[str]]: """ candidates: lista de (queryName, hash) Retorna o par escolhido (queryName, hash) """ if not candidates: return None, None # Score simples por heurística def score(name: str) -> int: n = name.lower() s = 0 if "chat" in n: s += 3 if "message" in n: s += 2 if "update" in n or "page" in n: s += 2 if "chatmessages" in n: s += 3 return s candidates.sort(key=lambda x: score(x[0]), reverse=True) return candidates[0] def scan_text_for_hashes(text: str) -> Tuple[Optional[str], Optional[Tuple[str, str]]]: """ Retorna: (send_hash, (sub_query_name, sub_hash)) — ambos opcionais """ send_hash = None m1 = SEND_RE.search(text) if m1: send_hash = m1.group(1) subs: List[Tuple[str, str]] = SUBS_ANY.findall(text) # [(name, hash), ...] chosen = pick_best_subscription(subs) # fallback extra (só hash, sem nome) if not chosen: mfb = SUBS_FALLBACK.search(text) if mfb: chosen = ("UnknownSubscription", mfb.group(1)) return send_hash, chosen

Adapte o restante:

python
# dentro do find_hashes_via_scripts() send_pair, subs_pair = scan_text_for_hashes(js_or_txt) # subs_pair = (query_name, hash)

E guarde também o query_name na saída de get_bootstrap:

python
return { ... "sub_hash": chosen_hash, "sub_query": chosen_name, # <-- novo ... }

E use no WS:

python
async def listen_via_websocket(chat_id: str, session: requests.Session, subscription_hash: str, subscription_query: str = "chatMessagesSubscription"): ... payload = { "type": "subscriptions", "subscriptions": { f"{subscription_query}_0_{chat_id}": { "queryName": subscription_query, "variables": {"chatId": chat_id}, "hash": subscription_hash, } } }

Por quê isso resolve?
Porque, mesmo que o Poe troque “chatMessagesSubscription” por, digamos, “chatPageUpdatesSubscription”, sua varredura ainda acha (nome, hash) e você assina usando o queryName correto.


B) Capturar o payload real de subscription pelos frames do WebSocket (robusto “à prova de mudanças”)

O próprio site manda algo assim no primeiro frame enviado pelo WS:

json
{ "type": "subscriptions", "subscriptions": { "chatPage_0_123...": { "queryName": "chatPageUpdatesSubscription", "variables": {"chatId": 1248142311}, "hash": "aaaaaaaa...64hex" } } }

Você consegue snifar isso com o Playwright sem precisar adivinhar nada. Basta ouvir o evento page.on("websocket") e os frames enviados:

python
async def get_bootstrap(...): ... captured = { ... "sub_hash_ws": None, "sub_query_ws": None, "sub_vars_ws": None, } def attach_ws_sniffer(page): def on_ws(ws): # queremos frames ENVIADOS, pois é aí que o site registra as subscriptions def on_sent(payload): try: data = json.loads(payload) if data.get("type") == "subscriptions": subs = data.get("subscriptions") or {} for _, spec in subs.items(): qn = (spec.get("queryName") or "").lower() # pegue a 1ª que pareça de chat if any(k in qn for k in ("chat", "message", "update")): captured["sub_hash_ws"] = spec.get("hash") captured["sub_query_ws"] = spec.get("queryName") captured["sub_vars_ws"] = spec.get("variables") or {} except Exception: pass ws.on("framesent", on_sent) page.on("websocket", on_ws) attach_ws_sniffer(page) # ... resto igual: goto, preencher textarea, Enter, etc. # aguarde alguns segundos p/ permitir que a página assine as subs for _ in range(50): if captured["sub_hash_ws"] and captured["sub_query_ws"]: break await page.wait_for_timeout(200) ... # escolha final: WS > bundles/inline final_sub_hash = captured["sub_hash_ws"] or subs_hash_bundles final_sub_query = captured["sub_query_ws"] or "chatMessagesSubscription" if not (final_sub_hash and re.fullmatch(r"[0-9a-f]{64}", final_sub_hash)): raise RuntimeError("Não foi possível extrair a hash de subscription (WS/bundles).") return { ... "sub_hash": final_sub_hash, "sub_query": final_sub_query, "sub_vars": captured["sub_vars_ws"] or {"chatId": None}, ... }

E ajuste o seu listener para reutilizar também as variáveis (forma/nomes corretos):

python
async def listen_via_websocket(chat_id: str, session: requests.Session, subscription_hash: str, subscription_query: str, subscription_vars: Optional[Dict[str, Any]] = None) -> str: ... vars_out = dict(subscription_vars or {}) # atualize chatId/Code conforme o que o site usou if "chatId" in vars_out: vars_out["chatId"] = int(chat_id) if isinstance(vars_out["chatId"], int) else str(chat_id) elif "chatCode" in vars_out: # se o site usar chatCode, você pode derivar do redirect/JSON; caso não tenha, tente só remover vars_out["chatCode"] = vars_out.get("chatCode") or None payload = { "type": "subscriptions", "subscriptions": { f"{subscription_query}_0_{chat_id}": { "queryName": subscription_query, "variables": vars_out or {"chatId": chat_id}, "hash": subscription_hash, } } } ...

No main() passe os novos campos:

python
subs_hash = info.get("sub_hash") subs_query = info.get("sub_query") or "chatMessagesSubscription" subs_vars = info.get("sub_vars") or {"chatId": None} final_answer = await listen_via_websocket( str(chat_id), session, subs_hash, subs_query, subs_vars )

Por que seu log confirma isso?

  • Você envia a sendMessageMutation e recebe 200 (aparece no site, ok).
  • Logo em seguida, o navegador faz queries como ChatLastMessageAreaQuery e marcações de seen.
  • E há métricas de “time_to_first_subscription_response” no receive_POST — ou seja, há uma subscription, só que o seu cliente externo não está assinando a mesma (faltou o hash/queryName certo).

Checklist rápido (evita outras pegadinhas)

  1. poe-tchannel: mantenha sincronizado entre header e cookie (poe-tchannel-channel). Você já faz isso, mas reforce após cada gql_POST (o Poe às vezes rotateia).
  2. poegraphql: respeite o valor que você capturar por request (tem endpoints com 0 e outros com 1).
  3. formkey e revision: use os capturados; não “chute”.
  4. Não bloqueie a navegação SPA: mesmo você “fulfillando” a sendMessageMutation no Playwright, deixe a página seguir pra view de /chat/... por alguns segundos — é nessa transição que ela dispara a subscription.
  5. Timeouts: dê ~10s para o sniffer de WS achar o frame de subscriptions.

Se quiser, te mando o arquivo completo já com essas mudanças embutidas (só falar qual versão do Python/Playwright você está usando).

Pregunta

Implemente tudo. atualize o código atual. mande apenas o código completo em seu output: # -- coding: utf-8 --

Poe GraphQL sender — Opção A (reenvio 1:1) + captura robusta da hash de chatMessagesSubscription

Observações rápidas:

- poe-tag-id muda a cada chamada. Se capturar e depois mudar query/clientNonce,

400 na certa (assinatura não confere).

- poegraphql: "0" ou "1" como string funciona.

- Evite setar "poe-channel-channel" (typo). Só "poe-tchannel-channel" já basta.

- Se algum cookie do Cloudflare expirar, o erro típico é 403/401, não 400.

Estratégia:

1) get_bootstrap(bot, cookies, prompt): abre a página logada, digita o PROMPT e

intercepta a sendMessageMutation EXATA (headers + body RAW). NÃO enviamos de verdade.

2) Na mesma função, varremos TODOS os scripts (src e inline) e extraímos a hash da

chatMessagesSubscription com regex tolerante (sem depender de frames WS).

3) No main(), reenvia o body RAW (headers quase idênticos) -> obtém chatId real.

4) Conecta ao tch WebSocket e assina usando a hash capturada -> lê a resposta (sem receive_POST).

import asyncio
import json
import re
from typing import Optional, Dict, Any, List, Tuple
import urllib.parse

import requests
import websockets
from playwright.async_api import async_playwright

==============================================================================

0) CONFIG – ajuste seus cookies/sessão aqui

==============================================================================

P_B_COOKIE = "fnWI711UP20Z-5hhB4qmXA%3D%3D" # obrigatório (cookie de sessão p-b)
P_LAT_COOKIE = "" # opcional
CF_CLEARANCE = "thwhcHgrOeXgMi7doUzJvgtSt5I4gzXO0m.H49jgyA0-1755601426-1.2.1.1-9uKyi3ob4O0gitbAw3w3FFJTZNDhz2lCDq.BSoTiGToSvGQ9u187hnoJSM3F7a9NAKHZS8jmqWNMxWV1zFM5umeCP7eGv8y474o4fpqWEbu.Mcmyajt6ZM10wtzkvKqmdvkTfYOW4HOZkVFxQoCjDKW9dokcRv.zhGvRA4N6li0tvYZARuAgHLx8SRmiB1jL90FI3i8x5rgxObnHHQEOX80IV7.4w1JJe6ipSveEI8w"
CF_BM = "EBefqZ01pvWR0B_MsvkraEXhpn3bBvHkAKEt9sBMJV4-1755601425-1.0.1.1-TLMm3MA2hJZrs2G94tXN7ySKgwjGLDDBj.L5EMp8LeFAPjSurFpNwRyCZgJ1Rj0hjHuTm5yxz8vKWHCB5srAqcKfO49qFPqk4fttffxLoog"
P_SB = ""

Se quiser forçar um canal específico, preencha; caso contrário será capturado

POE_TCHANNEL_FALLBACK = "poe-chan105-8888-eubnxknfqzvcppphsprm"

BOT_NAME = "GPT-5" # slug visível na URL
PROMPT = "Olá, tudo bem, qm é voce?" # mensagem a enviar

POE_URL_ROOT = "https://poe.com"
POE_API_URL = f"{POE_URL_ROOT}/api/gql_POST"

BASE_HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0",
"Accept": "/",
"Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8",
"Origin": POE_URL_ROOT,
"Referer": f"{POE_URL_ROOT}/{BOT_NAME}",
"Sec-Ch-Ua": '"Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"Content-Type": "application/json",
"poegraphql": "0", # string mesmo
}

============================== UTILS =========================================

def cookie_header_from_jar(jar: requests.cookies.RequestsCookieJar) -> str:
return "; ".join(f"{c.name}={c.value}" for c in jar)

def get_tchannel_from_cookies(jar: requests.cookies.RequestsCookieJar) -> Optional[str]:
for c in jar:
name = c.name.lower()
if "tchannel" in name and "channel" in name:
return c.value
return None

def ws_url_from_tchannel(channel: str) -> str:
m = re.search(r"chan(\d+)-", channel)
if not m:
raise ValueError(f"tchannel inesperado: {channel}")
shard = m.group(1)
return f"wss://tch{shard}.poe.com/up/{channel.replace('poe-','')}/updates?channel={channel}"

def parse_cookie_header_and_set(session: requests.Session, cookie_header: str):
"""Aplica um Cookie header literal no cookie jar (para uso posterior no WS)."""
if not cookie_header:
return
parts = [p.strip() for p in cookie_header.split(";") if "=" in p]
for part in parts:
try:
k, v = part.split("=", 1)
session.cookies.set(k.strip(), v.strip(), domain="poe.com", path="/")
except Exception:
continue

-------------------- regex robustas p/ hashes em bundles ----------------------

SEND_RE = re.compile(r'"sendMessageMutation"\s*:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)
SUBS_RE = re.compile(r'"chatMessagesSubscription"\s*:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)

fallback mais frouxo (ordem diferente):

SUBS_FALLBACK = re.compile(r'chatMessagesSubscription"\s*[,:{][^"]{0,400}?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL)

============================== BOOTSTRAP ======================================

async def get_bootstrap(bot_name: str, cookie_dict: Dict[str, str], prompt_for_capture: str) -> Dict[str, Optional[str]]:
"""
Abre a página logada, digita o prompt e intercepta a sendMessageMutation EXATA (headers + body RAW).
Também varre scripts (src + inline) para extrair a hash da chatMessagesSubscription.
"""
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()

text
# Injeta cookies de sessão add = [] for name in ("p-b", "p-lat", "cf_clearance", "__cf_bm", "p-sb"): val = cookie_dict.get(name) if val: add.append({"name": name, "value": val, "domain": "poe.com", "path": "/", "secure": True}) if add: await context.add_cookies(add) page = await context.new_page() await page.goto(f"{POE_URL_ROOT}/{bot_name}", wait_until="domcontentloaded") # formkey via função global ou __NEXT_DATA__ formkey = None try: formkey = await page.evaluate("window.ereNdsRqhp2Rd3LEW && window.ereNdsRqhp2Rd3LEW()") except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): try: json_text = await page.evaluate('document.getElementById("__NEXT_DATA__")?.textContent') if json_text: data = json.loads(json_text) def find_key(node, key): if isinstance(node, dict): for k, v in node.items(): if isinstance(k, str) and k.lower() == key and isinstance(v, str): return v r = find_key(v, key) if r: return r elif isinstance(node, list): for x in node: r = find_key(x, key) if r: return r return None fk2 = find_key(data, "formkey") if isinstance(fk2, str) and len(fk2) >= 32: formkey = fk2 except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): await context.close(); await browser.close() raise RuntimeError("Falha ao extrair poe-formkey.") # metas try: revision_meta = await page.evaluate('document.querySelector("meta[name=\'poe-revision\']")?.content') except Exception: revision_meta = None try: tag_id_meta = await page.evaluate('document.querySelector("meta[name=\'poe-tag-id\']")?.content') except Exception: tag_id_meta = None # ---------- função auxiliar: varrer scripts (src + inline) e achar hashes ---------- def scan_text_for_hashes(text: str) -> Tuple[Optional[str], Optional[str]]: send_hash = None subs_hash = None m1 = SEND_RE.search(text) if m1: send_hash = m1.group(1) m2 = SUBS_RE.search(text) if m2: subs_hash = m2.group(1) else: m2b = SUBS_FALLBACK.search(text) if m2b: subs_hash = m2b.group(1) return send_hash, subs_hash async def find_hashes_via_scripts() -> Tuple[Optional[str], Optional[str]]: send_hash_bundles = None subs_hash_bundles = None # 1) inline scripts try: inline_js: List[str] = await page.evaluate(""" Array.from(document.querySelectorAll('script:not([src])')) .map(s => s.textContent || '') """) except Exception: inline_js = [] for js in inline_js: s, sub = scan_text_for_hashes(js) send_hash_bundles = send_hash_bundles or s subs_hash_bundles = subs_hash_bundles or sub if send_hash_bundles and subs_hash_bundles: return send_hash_bundles, subs_hash_bundles # 2) script URLs (inclui preload) try: script_urls: List[str] = await page.evaluate(""" [ ...Array.from(document.scripts).map(s => s.src).filter(Boolean), ...Array.from(document.querySelectorAll('link[rel="preload"][as="script"]')).map(l => l.href).filter(Boolean) ] """) except Exception: script_urls = [] # normalizar e deduplicar norm_urls = [] seen = set() for u in script_urls: if not u: continue if u.startswith("/"): u = urllib.parse.urljoin(POE_URL_ROOT, u) if u in seen: continue seen.add(u) norm_urls.append(u) sess_tmp = requests.Session() for url in norm_urls: try: r = sess_tmp.get(url, timeout=15) if r.ok and "javascript" in r.headers.get("Content-Type", ""): txt = r.text s, sub = scan_text_for_hashes(txt) send_hash_bundles = send_hash_bundles or s subs_hash_bundles = subs_hash_bundles or sub if send_hash_bundles and subs_hash_bundles: break except Exception: continue return send_hash_bundles, subs_hash_bundles # primeira tentativa de achar hashes (antes de digitar o prompt) send_hash_bundles, subs_hash_bundles = await find_hashes_via_scripts() # Intercepta a sendMessageMutation (headers + body RAW) — e NÃO envia de verdade captured = { "payload_dict": None, "payload_raw": None, "hash": None, "req_headers": {}, "tag_id_hdr": None, "tchannel_hdr": None, "cookie_header": None, "revision_hdr": None, "formkey_hdr": None, } async def route_handler(route, request): try: if request.url.endswith("/api/gql_POST"): hdrs = {k.lower(): v for k, v in request.headers.items()} body = request.post_data or "" qn = hdrs.get("poe-queryname", "") if qn == "sendMessageMutation" or "sendMessageMutation" in (body or ""): captured["req_headers"] = {**captured["req_headers"], **hdrs} captured["payload_raw"] = body if "cookie" in hdrs: captured["cookie_header"] = hdrs["cookie"] if "poe-revision" in hdrs: captured["revision_hdr"] = hdrs["poe-revision"] if "poe-formkey" in hdrs: captured["formkey_hdr"] = hdrs["poe-formkey"] if "poe-tchannel" in hdrs: captured["tchannel_hdr"] = hdrs["poe-tchannel"] if "poe-tag-id" in hdrs: captured["tag_id_hdr"] = hdrs["poe-tag-id"] try: payload = json.loads(body) captured["payload_dict"] = payload captured["hash"] = (payload.get("extensions") or {}).get("hash") except Exception: pass # NÃO enviar de verdade — simulamos 200 e guardamos cópia fiel await route.fulfill(status=200, content_type="application/json", body='{"data":{"messageCreate":null}}') return except Exception: pass await route.continue_() await page.route("**/api/gql_POST", route_handler) # Digita o prompt real e "envia" (será fulfiled acima) try: locator = page.locator("textarea") if await locator.count() > 0: ta = locator.first await ta.click() await ta.fill(prompt_for_capture) else: ed = page.locator('div[contenteditable="true"]').first await ed.click() await ed.fill(prompt_for_capture) await page.keyboard.press("Enter") except Exception: pass # Aguarda captura do body (até ~20s) for _ in range(100): if captured["payload_raw"]: break await page.wait_for_timeout(200) # segunda tentativa de achar a subs hash (scripts podem carregar tardiamente) if not subs_hash_bundles: s2, sub2 = await find_hashes_via_scripts() send_hash_bundles = send_hash_bundles or s2 subs_hash_bundles = subs_hash_bundles or sub2 try: await page.unroute("**/api/gql_POST", route_handler) except Exception: pass await context.close(); await browser.close() # Preferências finais final_formkey = captured["formkey_hdr"] or formkey final_revision = captured["revision_hdr"] or revision_meta final_tag_id = captured["tag_id_hdr"] or tag_id_meta final_tchannel = captured["tchannel_hdr"] payload_dict = captured["payload_dict"] payload_raw = captured["payload_raw"] hash_intercept = captured["hash"] if not payload_raw: raise RuntimeError("Não foi possível capturar a sendMessageMutation (body RAW) para o prompt fornecido.") return { "formkey": final_formkey, "revision": final_revision, "send_hash": (hash_intercept or send_hash_bundles), "sub_hash": subs_hash_bundles, # <- obtido de bundles/inline com regex robusta "tag_id": final_tag_id, "tchannel_hdr": final_tchannel, "cookie_header": captured["cookie_header"], "payload_base": payload_dict, # JSON parseado (apenas para log) "payload_raw": payload_raw, # BODY STRING EXATA (usar no POST) "req_headers": captured["req_headers"] or {}, # HEADERS EXATOS (lowercase) }

============================== STREAM PARSING =================================

def extract_text_pieces(event: Any) -> List[str]:
out: List[str] = []
if isinstance(event, dict):
for k in ("text_new", "response", "delta", "text"):
v = event.get(k)
if isinstance(v, str) and v:
out.append(v)
for v in event.values():
if isinstance(v, (dict, list)):
out.extend(extract_text_pieces(v))
elif isinstance(event, list):
for x in event:
out.extend(extract_text_pieces(x))
return out

def is_final_event(event: Dict[str, Any]) -> bool:
data = event.get("data") or {}
cat = (event.get("category") or "").lower()
state = (data.get("state") or data.get("message_state") or "").lower()
if "completed" in cat:
return True
if state in {"complete", "completed", "stopped", "aborted"}:
return True
if data.get("is_final") is True:
return True
return False

============================== RECEPÇÃO VIA WS =================================

async def listen_via_websocket(chat_id: str, session: requests.Session, subscription_hash: str) -> str:
tchannel = session.headers.get("poe-tchannel") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK
if not tchannel:
raise RuntimeError("Sem poe-tchannel (cookie/forçado).")

text
# Monta URL do WS m = re.search(r"chan(\d+)-", tchannel) if not m: raise RuntimeError(f"tchannel inesperado: {tchannel}") shard = m.group(1) ws_url = f"wss://tch{shard}.poe.com/up/{tchannel.replace('poe-','')}/updates?channel={tchannel}" ws_headers = dict(BASE_HEADERS) ws_headers["poe-tchannel"] = tchannel ws_headers["Cookie"] = cookie_header_from_jar(session.cookies) # Assina explicitamente a subscription p/ ESTE chatId real payload = { "type": "subscriptions", "subscriptions": { f"chatMessages_0_{chat_id}": { "queryName": "chatMessagesSubscription", "variables": {"chatId": chat_id}, "hash": subscription_hash, } } } full = "" async with websockets.connect(ws_url, extra_headers=ws_headers, max_size=None) as ws: await ws.send(json.dumps(payload)) async for message in ws: data = json.loads(message) if data.get("mtype") == "subscriptionUpdate": for p in data.get("payload", {}).get("payloads", []): new = p.get("data", {}).get("messageAdded") if not new: continue piece = new.get("text_new") or "" if piece: print(piece, end="", flush=True) full += piece if (new.get("state") or "").lower() in {"complete", "completed"}: print("\n--- Resposta Completa (WS) ---") return full return full

============================== DIAGNÓSTICO ====================================

def summarize_payload_and_headers(payload_base: Dict[str, Any], req_headers: Dict[str, str]) -> Tuple[str, str]:
vars_obj = (payload_base or {}).get("variables") or {}
exts_obj = (payload_base or {}).get("extensions") or {}
sdid = vars_obj.get("sdid")
bot = vars_obj.get("bot")
hashv = exts_obj.get("hash")
hsum = f"bot:{str(bot)[:12]}… sdid:{str(sdid)[:12]}… hash:{str(hashv)[:8]}…"
krit = {k: req_headers.get(k) for k in ["poe-formkey", "poe-revision", "poe-tag-id", "poe-tchannel", "poe-queryname", "poegraphql"]}
ksum = " ".join(f"{k.split('-')[1] if k.startswith('poe-') else k}:{(v[:12]+'…') if isinstance(v, str) and len(v)>14 else v}" for k, v in krit.items())
return hsum, ksum

================================= MAIN ========================================

async def main():
session = requests.Session()
session.headers.update(BASE_HEADERS)

text
# Cookies base no jar (para WS posteriormente) session.cookies.update({"p-b": P_B_COOKIE}) if P_LAT_COOKIE: session.cookies.set("p-lat", P_LAT_COOKIE, domain="poe.com", path="/") if CF_CLEARANCE: session.cookies.set("cf_clearance", CF_CLEARANCE, domain="poe.com", path="/") if CF_BM: session.cookies.set("__cf_bm", CF_BM, domain="poe.com", path="/") if P_SB: session.cookies.set("p-sb", P_SB, domain="poe.com", path="/") try: # 1) Captura 1:1 e sub_hash via bundles/inline info = await get_bootstrap( BOT_NAME, {"p-b": P_B_COOKIE, "p-lat": P_LAT_COOKIE, "cf_clearance": CF_CLEARANCE, "__cf_bm": CF_BM, "p-sb": P_SB}, PROMPT, ) payload_raw = info.get("payload_raw") # STRING exata payload_capturado = info.get("payload_base") # JSON (apenas para log) req_headers_cap = {k.lower(): v for k, v in (info.get("req_headers") or {}).items()} subs_hash = info.get("sub_hash") if not payload_raw: raise RuntimeError("Não capturei a sendMessageMutation (body RAW).") if not subs_hash or not re.fullmatch(r"[0-9a-f]{64}", subs_hash): raise RuntimeError("Não foi possível extrair a hash de chatMessagesSubscription dos bundles/inline.") # Cookies exatos do intercept no jar (para WS) captured_cookie_header = info.get("cookie_header") or "" parse_cookie_header_and_set(session, captured_cookie_header) # Headers críticos de sessão para WS formkey = info.get("formkey") revision = info.get("revision") tchannel = info.get("tchannel_hdr") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK if formkey: session.headers["poe-formkey"] = formkey if revision: session.headers["poe-revision"] = revision if tchannel: session.headers["poe-tchannel"] = tchannel session.cookies.set("poe-tchannel-channel", tchannel, domain="poe.com", path="/") # LOG p_sum, h_sum = summarize_payload_and_headers(payload_capturado or {}, req_headers_cap) tch_cookie = get_tchannel_from_cookies(session.cookies) or "n/a" print( f"formkey:{(formkey or '')[:6]}… tag_hdr:{(info.get('tag_id') or '')[:8]}… " f"tchannel_hdr:{(tchannel or '')[:18]}… tchannel_cookie:{tch_cookie[:18]}… " f"sub_hash:{(subs_hash or 'n/a')[:8]}… revision:{(revision or 'n/a')[:10]}…" ) print("payload_base:", p_sum) print("req_hdrs:", h_sum) # 2) Envio 1:1 — headers quase idênticos + body RAW + Cookie literal print("\nEnviando a pergunta via GraphQL com payload/headers CAPTURADOS…") blocked = {"content-length", "host", "connection", "accept-encoding"} gql_headers = {k: v for k, v in req_headers_cap.items() if k not in blocked} gql_headers["content-type"] = "application/json" gql_headers["referer"] = f"{POE_URL_ROOT}/{BOT_NAME}" gql_headers["origin"] = POE_URL_ROOT if captured_cookie_header: gql_headers["cookie"] = captured_cookie_header resp = session.post(POE_API_URL, data=payload_raw, headers=gql_headers) if "poe-tchannel" in resp.headers: session.headers["poe-tchannel"] = resp.headers["poe-tchannel"] resp.raise_for_status() data = resp.json() root = data.get("data", {}) if isinstance(data, dict) else {} chat = None if "messageCreate" in root: chat = (root.get("messageCreate") or {}).get("chat") or {} elif "messageEdgeCreate" in root: chat = (root.get("messageEdgeCreate") or {}).get("chat") or {} if not chat: raise RuntimeError("Resposta sem objeto 'chat' esperado (messageCreate/messageEdgeCreate).") chat_id = chat.get("chatId") or chat.get("id") if not chat_id: raise RuntimeError("Não consegui obter o chatId.") print(f"Chat criado! ID: {chat_id}") # 3) Recepção via WS (sem receive_POST) final_answer = await listen_via_websocket(str(chat_id), session, subs_hash) print("\nRESPOSTA FINAL:") print(final_answer) except requests.HTTPError as e: body = getattr(e.response, "text", "")[:2000] print(f"HTTPError: {e}\nBody: {body}") except Exception as e: print(f"Erro: {e}")

if name == "main":
asyncio.run(main())

Pensamiento

Updating code for WebSocket handling

I need to update the regex in the code to handle multiple subscription names instead of just the old one for chatMessagesSubscription. I'll also add a WebSocket sniffer to capture queryName, hash, and variables. Additionally, I'll update the logic to work with either chatCode or chatId, ensuring variables are captured accurately. I'll make sure cookies and channels stay intact.

Integrating new functions and WebSocket sniffer

I’ll integrate a more generic regex, creating SUBS_ANY while keeping SUBS_FALLBACK. For scan_text_for_hashes, I’ll adjust the return values to include both sub_name and sub_hash. I'll also implement a WebSocket sniffer using Playwright’s page.on("websocket") and handle framesent and framereceived events.

Implementing WebSocket sniffer and updates

I’ll add attach_ws_sniffer(page) to capture the first subscription packet. I’ll keep using the scan_text_for_hashes function, but update it to capture names too. Afterward, I’ll modify the main function to include updated parameters for subs_hash, subs_query, and subs_vars. We’ll ensure the subscription object uses a formatted subscription_query for consistency.

Improving subscription message parsing

I’ll enhance the way we parse subscription messages. Instead of looking only for messageAdded in the payload, I’ll implement recursive parsing using extract_text_pieces to handle varying update types like messageUpdated. I’ll adjust the function to accumulate text and detect when the event is final using the is_final_event function, based on state or other conditions.

Thought for 1m 21s

Respuesta

-- coding: utf-8 --

Poe GraphQL sender — Reenvio 1:1 + captura robusta de subscription (regex genérica + sniffer de WS)

Observações rápidas:

- poe-tag-id muda a cada chamada. Se capturar e depois mudar query/clientNonce,

400 na certa (assinatura não confere).

- poegraphql: "0" ou "1" como string funciona.

- Evite setar "poe-channel-channel" (typo). Só "poe-tchannel-channel" já basta.

- Se algum cookie do Cloudflare expirar, o erro típico é 403/401, não 400.

Estratégia:

1) get_bootstrap(bot, cookies, prompt): abre a página logada, digita o PROMPT e

intercepta a sendMessageMutation EXATA (headers + body RAW). NÃO enviamos de verdade.

2) Na mesma função, duas rotas para descobrir a subscription:

2.1) Varremos TODOS os scripts (src e inline) e extraímos (queryName, hash) de QUALQUER *Subscription

com regex tolerante (heurística prefere nomes com "chat"/"message"/"update").

2.2) (Preferencial) Sniffer de WebSocket: captura o primeiro frame "type: subscriptions"

que a página envia, guardando (queryName, hash, variables).

Usamos WS > bundles (se ambos existirem).

3) No main(), reenvia o body RAW (headers quase idênticos) -> obtém chatId real.

4) Conecta ao tch WebSocket e assina usando (queryName, hash, variables) capturados -> lê a resposta.

import asyncio import json import re from typing import Optional, Dict, Any, List, Tuple import urllib.parse

import requests import websockets from playwright.async_api import async_playwright

==============================================================================

0) CONFIG – ajuste seus cookies/sessão aqui

==============================================================================

P_B_COOKIE = "fnWI711UP20Z-5hhB4qmXA%3D%3D" # obrigatório (cookie de sessão p-b) P_LAT_COOKIE = "" # opcional CF_CLEARANCE = "thwhcHgrOeXgMi7doUzJvgtSt5I4gzXO0m.H49jgyA0-1755601426-1.2.1.1-9uKyi3ob4O0gitbAw3w3FFJTZNDhz2lCDq.BSoTiGToSvGQ9u187hnoJSM3F7a9NAKHZS8jmqWNMxWV1zFM5umeCP7eGv8y474o4fpqWEbu.Mcmyajt6ZM10wtzkvKqmdvkTfYOW4HOZkVFxQoCjDKW9dokcRv.zhGvRA4N6li0tvYZARuAgHLx8SRmiB1jL90FI3i8x5rgxObnHHQEOX80IV7.4w1JJe6ipSveEI8w" CF_BM = "EBefqZ01pvWR0B_MsvkraEXhpn3bBvHkAKEt9sBMJV4-1755601425-1.0.1.1-TLMm3MA2hJZrs2G94tXN7ySKgwjGLDDBj.L5EMp8LeFAPjSurFpNwRyCZgJ1Rj0hjHuTm5yxz8vKWHCB5srAqcKfO49qFPqk4fttffxLoog" P_SB = ""

Se quiser forçar um canal específico, preencha; caso contrário será capturado

POE_TCHANNEL_FALLBACK = "poe-chan105-8888-eubnxknfqzvcppphsprm"

BOT_NAME = "GPT-5" # slug visível na URL PROMPT = "Olá, tudo bem, qm é voce?" # mensagem a enviar

POE_URL_ROOT = "https://poe.com" POE_API_URL = f"{POE_URL_ROOT}/api/gql_POST"

BASE_HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0", "Accept": "/", "Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8", "Origin": POE_URL_ROOT, "Referer": f"{POE_URL_ROOT}/{BOT_NAME}", "Sec-Ch-Ua": '"Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"', "Sec-Ch-Ua-Mobile": "?0", "Sec-Ch-Ua-Platform": '"Windows"', "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "Content-Type": "application/json", "poegraphql": "0", # string mesmo }

============================== UTILS =========================================

def cookie_header_from_jar(jar: requests.cookies.RequestsCookieJar) -> str: return "; ".join(f"{c.name}={c.value}" for c in jar)

def get_tchannel_from_cookies(jar: requests.cookies.RequestsCookieJar) -> Optional[str]: for c in jar: name = c.name.lower() if "tchannel" in name and "channel" in name: return c.value return None

def ws_url_from_tchannel(channel: str) -> str: m = re.search(r"chan(\d+)-", channel) if not m: raise ValueError(f"tchannel inesperado: {channel}") shard = m.group(1) return f"wss://tch{shard}.poe.com/up/{channel.replace('poe-','')}/updates?channel={channel}"

def parse_cookie_header_and_set(session: requests.Session, cookie_header: str): """Aplica um Cookie header literal no cookie jar (para uso posterior no WS).""" if not cookie_header: return parts = [p.strip() for p in cookie_header.split(";") if "=" in p] for part in parts: try: k, v = part.split("=", 1) session.cookies.set(k.strip(), v.strip(), domain="poe.com", path="/") except Exception: continue

-------------------- regex robustas p/ hashes em bundles ----------------------

SEND_RE = re.compile( r'"sendMessageMutation"\s*:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL )

Captura QUALQUER NomeSubscription + hash (ex.: chatMessagesSubscription, chatPageUpdatesSubscription, etc.)

SUBS_ANY = re.compile( r'"([A-Za-z0-9_]Subscription)"\s:\s*{[^}]?"hash"\s:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL )

Fallback bem frouxo (só a palavra Subscription perto de "hash")

SUBS_FALLBACK_GENERIC = re.compile( r'Subscription"\s*[,:{][^"]{0,400}?"hash"\s*:\s*"([0-9a-f]{64})"', re.IGNORECASE | re.DOTALL )

def _score_subscription_name(name: str) -> int: n = name.lower() s = 0 if "chat" in n: s += 3 if "message" in n: s += 2 if "update" in n or "page" in n: s += 2 if "chatmessages" in n: s += 3 return s

def pick_best_subscription(candidates: List[Tuple[str, str]]) -> Optional[Tuple[str, str]]: """candidates: [(queryName, hash)] -> retorna a melhor pelo score simples.""" if not candidates: return None candidates.sort(key=lambda x: _score_subscription_name(x[0]), reverse=True) return candidates[0]

============================== BOOTSTRAP ======================================

async def get_bootstrap(bot_name: str, cookie_dict: Dict[str, str], prompt_for_capture: str) -> Dict[str, Optional[str]]: """ Abre a página logada, digita o prompt e intercepta a sendMessageMutation EXATA (headers + body RAW). Também varre scripts (src + inline) e captura a subscription (nome + hash). Além disso, sniffa o primeiro frame de subscriptions do WebSocket (fonte mais confiável). """ async with async_playwright() as p: browser = await p.chromium.launch(headless=True) context = await browser.new_context()

text
# Injeta cookies de sessão add = [] for name in ("p-b", "p-lat", "cf_clearance", "__cf_bm", "p-sb"): val = cookie_dict.get(name) if val: add.append({"name": name, "value": val, "domain": "poe.com", "path": "/", "secure": True}) if add: await context.add_cookies(add) page = await context.new_page() # ---- Sniffer de WebSocket: captura (queryName, hash, variables) quando a página assina captured_ws_sub = { "hash": None, "query": None, "variables": None, } def attach_ws_sniffer(pg): def on_ws(ws): def on_sent(payload: str): try: data = json.loads(payload) if data.get("type") == "subscriptions": subs = data.get("subscriptions") or {} for _, spec in subs.items(): qn = (spec.get("queryName") or "") qnl = qn.lower() if any(k in qnl for k in ("chat", "message", "update")): captured_ws_sub["hash"] = spec.get("hash") captured_ws_sub["query"] = spec.get("queryName") captured_ws_sub["variables"] = spec.get("variables") or {} # não paramos aqui: deixamos caso venham múltiplas; ficamos com a 1ª que parece de chat break except Exception: pass ws.on("framesent", on_sent) pg.on("websocket", on_ws) attach_ws_sniffer(page) await page.goto(f"{POE_URL_ROOT}/{bot_name}", wait_until="domcontentloaded") # formkey via função global ou __NEXT_DATA__ formkey = None try: formkey = await page.evaluate("window.ereNdsRqhp2Rd3LEW && window.ereNdsRqhp2Rd3LEW()") except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): try: json_text = await page.evaluate('document.getElementById("__NEXT_DATA__")?.textContent') if json_text: data = json.loads(json_text) def find_key(node, key): if isinstance(node, dict): for k, v in node.items(): if isinstance(k, str) and k.lower() == key and isinstance(v, str): return v r = find_key(v, key) if r: return r elif isinstance(node, list): for x in node: r = find_key(x, key) if r: return r return None fk2 = find_key(data, "formkey") if isinstance(fk2, str) and len(fk2) >= 32: formkey = fk2 except Exception: pass if not (isinstance(formkey, str) and len(formkey) >= 32): await context.close(); await browser.close() raise RuntimeError("Falha ao extrair poe-formkey.") # metas try: revision_meta = await page.evaluate('document.querySelector("meta[name=\'poe-revision\']")?.content') except Exception: revision_meta = None try: tag_id_meta = await page.evaluate('document.querySelector("meta[name=\'poe-tag-id\']")?.content') except Exception: tag_id_meta = None # ---------- função auxiliar: varrer scripts (src + inline) e achar hashes ---------- def scan_text_for_hashes(text: str) -> Tuple[Optional[str], Optional[Tuple[str, str]]]: """ Retorna: (send_hash, (sub_query_name, sub_hash)) — ambos opcionais """ send_hash = None m1 = SEND_RE.search(text) if m1: send_hash = m1.group(1) found = SUBS_ANY.findall(text) # [(name, hash), ...] chosen = pick_best_subscription(found) if found else None if not chosen: mfb = SUBS_FALLBACK_GENERIC.search(text) if mfb: chosen = ("UnknownSubscription", mfb.group(1)) return send_hash, chosen async def find_hashes_via_scripts() -> Tuple[Optional[str], Optional[str], Optional[str]]: send_hash_bundles = None subs_name_bundles = None subs_hash_bundles = None # 1) inline scripts try: inline_js: List[str] = await page.evaluate(""" Array.from(document.querySelectorAll('script:not([src])')) .map(s => s.textContent || '') """) except Exception: inline_js = [] for js in inline_js: s, chosen = scan_text_for_hashes(js) if s and not send_hash_bundles: send_hash_bundles = s if chosen and not subs_hash_bundles: subs_name_bundles, subs_hash_bundles = chosen if send_hash_bundles and subs_hash_bundles: return send_hash_bundles, subs_name_bundles, subs_hash_bundles # 2) script URLs (inclui preload) try: script_urls: List[str] = await page.evaluate(""" [ ...Array.from(document.scripts).map(s => s.src).filter(Boolean), ...Array.from(document.querySelectorAll('link[rel="preload"][as="script"]')).map(l => l.href).filter(Boolean) ] """) except Exception: script_urls = [] # normalizar e deduplicar norm_urls = [] seen = set() for u in script_urls: if not u: continue if u.startswith("/"): u = urllib.parse.urljoin(POE_URL_ROOT, u) if u in seen: continue seen.add(u) norm_urls.append(u) sess_tmp = requests.Session() for url in norm_urls: try: r = sess_tmp.get(url, timeout=15) if r.ok and "javascript" in r.headers.get("Content-Type", ""): txt = r.text s, chosen = scan_text_for_hashes(txt) if s and not send_hash_bundles: send_hash_bundles = s if chosen and not subs_hash_bundles: subs_name_bundles, subs_hash_bundles = chosen if send_hash_bundles and subs_hash_bundles: break except Exception: continue return send_hash_bundles, subs_name_bundles, subs_hash_bundles # primeira tentativa de achar hashes (antes de digitar o prompt) send_hash_bundles, subs_name_bundles, subs_hash_bundles = await find_hashes_via_scripts() # Intercepta a sendMessageMutation (headers + body RAW) — e NÃO envia de verdade captured = { "payload_dict": None, "payload_raw": None, "hash": None, "req_headers": {}, "tag_id_hdr": None, "tchannel_hdr": None, "cookie_header": None, "revision_hdr": None, "formkey_hdr": None, } async def route_handler(route, request): try: if request.url.endswith("/api/gql_POST"): hdrs = {k.lower(): v for k, v in request.headers.items()} body = request.post_data or "" qn = hdrs.get("poe-queryname", "") if qn == "sendMessageMutation" or "sendMessageMutation" in (body or ""): captured["req_headers"] = {**captured["req_headers"], **hdrs} captured["payload_raw"] = body if "cookie" in hdrs: captured["cookie_header"] = hdrs["cookie"] if "poe-revision" in hdrs: captured["revision_hdr"] = hdrs["poe-revision"] if "poe-formkey" in hdrs: captured["formkey_hdr"] = hdrs["poe-formkey"] if "poe-tchannel" in hdrs: captured["tchannel_hdr"] = hdrs["poe-tchannel"] if "poe-tag-id" in hdrs: captured["tag_id_hdr"] = hdrs["poe-tag-id"] try: payload = json.loads(body) captured["payload_dict"] = payload captured["hash"] = (payload.get("extensions") or {}).get("hash") except Exception: pass # NÃO enviar de verdade — simulamos 200 e guardamos cópia fiel await route.fulfill(status=200, content_type="application/json", body='{"data":{"messageCreate":null}}') return except Exception: pass await route.continue_() await page.route("**/api/gql_POST", route_handler) # Digita o prompt real e "envia" (será fulfiled acima) try: locator = page.locator("textarea") if await locator.count() > 0: ta = locator.first await ta.click() await ta.fill(prompt_for_capture) else: ed = page.locator('div[contenteditable="true"]').first await ed.click() await ed.fill(prompt_for_capture) await page.keyboard.press("Enter") except Exception: pass # Aguarda captura do body (até ~20s) for _ in range(100): if captured["payload_raw"]: break await page.wait_for_timeout(200) # Dê um tempo para o SPA assinar as subscriptions e o sniffer capturar o frame for _ in range(50): if captured_ws_sub["hash"] and captured_ws_sub["query"]: break await page.wait_for_timeout(200) # segunda tentativa de achar a subs hash (scripts podem carregar tardiamente) if not subs_hash_bundles: s2, name2, sub2 = await find_hashes_via_scripts() send_hash_bundles = send_hash_bundles or s2 subs_name_bundles = subs_name_bundles or name2 subs_hash_bundles = subs_hash_bundles or sub2 try: await page.unroute("**/api/gql_POST", route_handler) except Exception: pass await context.close(); await browser.close() # Preferências finais final_formkey = captured["formkey_hdr"] or formkey final_revision = captured["revision_hdr"] or revision_meta final_tag_id = captured["tag_id_hdr"] or tag_id_meta final_tchannel = captured["tchannel_hdr"] payload_dict = captured["payload_dict"] payload_raw = captured["payload_raw"] hash_intercept = captured["hash"] # Subscription final: priorize WS sniffer; caia para bundles/inline se necessário final_sub_hash = captured_ws_sub["hash"] or subs_hash_bundles final_sub_query = captured_ws_sub["query"] or (subs_name_bundles or "chatMessagesSubscription") final_sub_vars = captured_ws_sub["variables"] or {"chatId": None} if not payload_raw: raise RuntimeError("Não foi possível capturar a sendMessageMutation (body RAW) para o prompt fornecido.") if not (final_sub_hash and re.fullmatch(r"[0-9a-f]{64}", final_sub_hash)): raise RuntimeError("Não foi possível extrair a hash de subscription (WS/bundles).") return { "formkey": final_formkey, "revision": final_revision, "send_hash": (hash_intercept or send_hash_bundles), "sub_hash": final_sub_hash, "sub_query": final_sub_query, "sub_vars": final_sub_vars, "tag_id": final_tag_id, "tchannel_hdr": final_tchannel, "cookie_header": captured["cookie_header"], "payload_base": payload_dict, # JSON parseado (apenas para log) "payload_raw": payload_raw, # BODY STRING EXATA (usar no POST) "req_headers": captured["req_headers"] or {}, # HEADERS EXATOS (lowercase) }

============================== STREAM PARSING =================================

def extract_text_pieces(event: Any) -> List[str]: out: List[str] = [] if isinstance(event, dict): for k in ("text_new", "response", "delta", "text", "partial_response"): v = event.get(k) if isinstance(v, str) and v: out.append(v) for v in event.values(): if isinstance(v, (dict, list)): out.extend(extract_text_pieces(v)) elif isinstance(event, list): for x in event: out.extend(extract_text_pieces(x)) return out

def is_final_event(event: Dict[str, Any]) -> bool: data = event.get("data") or {} cat = (event.get("category") or "").lower() state = (data.get("state") or data.get("message_state") or "").lower() if "completed" in cat: return True if state in {"complete", "completed", "stopped", "aborted"}: return True if data.get("is_final") is True: return True return False

============================== RECEPÇÃO VIA WS =================================

async def listen_via_websocket(chat_id: str, session: requests.Session, subscription_hash: str, subscription_query: str, subscription_vars: Optional[Dict[str, Any]] = None) -> str: tchannel = session.headers.get("poe-tchannel") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK if not tchannel: raise RuntimeError("Sem poe-tchannel (cookie/forçado).")

text
# Monta URL do WS m = re.search(r"chan(\d+)-", tchannel) if not m: raise RuntimeError(f"tchannel inesperado: {tchannel}") shard = m.group(1) ws_url = f"wss://tch{shard}.poe.com/up/{tchannel.replace('poe-','')}/updates?channel={tchannel}" ws_headers = dict(BASE_HEADERS) ws_headers["poe-tchannel"] = tchannel ws_headers["Cookie"] = cookie_header_from_jar(session.cookies) # Variables: reutilize o que a página usou; ajuste chatId/chatCode se existir vars_out = dict(subscription_vars or {}) if "chatId" in vars_out: try: vars_out["chatId"] = int(chat_id) except Exception: vars_out["chatId"] = chat_id elif "chatCode" in vars_out: # se o site usar chatCode, mantenha o que veio; caso vazio, WS pode ignorar vars_out["chatCode"] = vars_out.get("chatCode") or None else: vars_out["chatId"] = chat_id # Assina explicitamente a subscription p/ ESTE chatId real payload = { "type": "subscriptions", "subscriptions": { f"{subscription_query}_0_{chat_id}": { "queryName": subscription_query, "variables": vars_out, "hash": subscription_hash, } } } full = "" async with websockets.connect(ws_url, extra_headers=ws_headers, max_size=None) as ws: await ws.send(json.dumps(payload)) async for message in ws: try: data = json.loads(message) except Exception: continue if data.get("mtype") == "subscriptionUpdate": # payloads: lista; cada um tem 'payload' interno. Vamos extrair textos onde estiverem. payloads = data.get("payload", {}).get("payloads", []) for p in payloads: # tente os caminhos comuns d = p.get("data") or {} # texto incremental/definitivo pieces = extract_text_pieces(d) if pieces: chunk = "".join(pieces) print(chunk, end="", flush=True) full += chunk # heurística de finalização if is_final_event(p) or is_final_event(d): print("\n--- Resposta Completa (WS) ---") return full # caminhos de estado conhecidos (messageAdded/messageUpdated) for key in ("messageAdded", "messageUpdated", "messageTruncated"): node = d.get(key) or {} state = (node.get("state") or "").lower() if state in {"complete", "completed"}: print("\n--- Resposta Completa (WS) ---") return full return full

============================== DIAGNÓSTICO ====================================

def summarize_payload_and_headers(payload_base: Dict[str, Any], req_headers: Dict[str, str]) -> Tuple[str, str]: vars_obj = (payload_base or {}).get("variables") or {} exts_obj = (payload_base or {}).get("extensions") or {} sdid = vars_obj.get("sdid") bot = vars_obj.get("bot") hashv = exts_obj.get("hash") hsum = f"bot:{str(bot)[:12]}… sdid:{str(sdid)[:12]}… hash:{str(hashv)[:8]}…" krit = {k: req_headers.get(k) for k in ["poe-formkey", "poe-revision", "poe-tag-id", "poe-tchannel", "poe-queryname", "poegraphql"]} ksum = " ".join(f"{k.split('-')[1] if k.startswith('poe-') else k}:{(v[:12]+'…') if isinstance(v, str) and len(v)>14 else v}" for k, v in krit.items()) return hsum, ksum

================================= MAIN ========================================

async def main(): session = requests.Session() session.headers.update(BASE_HEADERS)

text
# Cookies base no jar (para WS posteriormente) session.cookies.update({"p-b": P_B_COOKIE}) if P_LAT_COOKIE: session.cookies.set("p-lat", P_LAT_COOKIE, domain="poe.com", path="/") if CF_CLEARANCE: session.cookies.set("cf_clearance", CF_CLEARANCE, domain="poe.com", path="/") if CF_BM: session.cookies.set("__cf_bm", CF_BM, domain="poe.com", path="/") if P_SB: session.cookies.set("p-sb", P_SB, domain="poe.com", path="/") try: # 1) Captura 1:1 e subscription via WS/bundles info = await get_bootstrap( BOT_NAME, {"p-b": P_B_COOKIE, "p-lat": P_LAT_COOKIE, "cf_clearance": CF_CLEARANCE, "__cf_bm": CF_BM, "p-sb": P_SB}, PROMPT, ) payload_raw = info.get("payload_raw") # STRING exata payload_capturado = info.get("payload_base") # JSON (apenas para log) req_headers_cap = {k.lower(): v for k, v in (info.get("req_headers") or {}).items()} subs_hash = info.get("sub_hash") subs_query = info.get("sub_query") or "chatMessagesSubscription" subs_vars = info.get("sub_vars") or {"chatId": None} if not payload_raw: raise RuntimeError("Não capturei a sendMessageMutation (body RAW).") if not subs_hash or not re.fullmatch(r"[0-9a-f]{64}", subs_hash): raise RuntimeError("Não foi possível extrair a hash de subscription (WS/bundles).") # Cookies exatos do intercept no jar (para WS) captured_cookie_header = info.get("cookie_header") or "" parse_cookie_header_and_set(session, captured_cookie_header) # Headers críticos de sessão para WS formkey = info.get("formkey") revision = info.get("revision") tchannel = info.get("tchannel_hdr") or get_tchannel_from_cookies(session.cookies) or POE_TCHANNEL_FALLBACK if formkey: session.headers["poe-formkey"] = formkey if revision: session.headers["poe-revision"] = revision if tchannel: session.headers["poe-tchannel"] = tchannel session.cookies.set("poe-tchannel-channel", tchannel, domain="poe.com", path="/") # LOG p_sum, h_sum = summarize_payload_and_headers(payload_capturado or {}, req_headers_cap) tch_cookie = get_tchannel_from_cookies(session.cookies) or "n/a" print( f"formkey:{(formkey or '')[:6]}… tag_hdr:{(info.get('tag_id') or '')[:8]}… " f"tchannel_hdr:{(tchannel or '')[:18]}… tchannel_cookie:{tch_cookie[:18]}… " f"sub_hash:{(subs_hash or 'n/a')[:8]}… sub_query:{subs_query} revision:{(revision or 'n/a')[:10]}…" ) print("payload_base:", p_sum) print("req_hdrs:", h_sum) # 2) Envio 1:1 — headers quase idênticos + body RAW + Cookie literal print("\nEnviando a pergunta via GraphQL com payload/headers CAPTURADOS…") blocked = {"content-length", "host", "connection", "accept-encoding"} gql_headers = {k: v for k, v in req_headers_cap.items() if k not in blocked} gql_headers["content-type"] = "application/json" gql_headers["referer"] = f"{POE_URL_ROOT}/{BOT_NAME}" gql_headers["origin"] = POE_URL_ROOT if captured_cookie_header: gql_headers["cookie"] = captured_cookie_header resp = session.post(POE_API_URL, data=payload_raw, headers=gql_headers) if "poe-tchannel" in resp.headers: session.headers["poe-tchannel"] = resp.headers["poe-tchannel"] resp.raise_for_status() data = resp.json() root = data.get("data", {}) if isinstance(data, dict) else {} chat = None if "messageCreate" in root: chat = (root.get("messageCreate") or {}).get("chat") or {} elif "messageEdgeCreate" in root: chat = (root.get("messageEdgeCreate") or {}).get("chat") or {} if not chat: raise RuntimeError("Resposta sem objeto 'chat' esperado (messageCreate/messageEdgeCreate).") chat_id = chat.get("chatId") or chat.get("id") if not chat_id: raise RuntimeError("Não consegui obter o chatId.") print(f"Chat criado! ID: {chat_id}") # 3) Recepção via WS (sem receive_POST) final_answer = await listen_via_websocket(str(chat_id), session, subs_hash, subs_query, subs_vars) print("\nRESPOSTA FINAL:") print(final_answer) except requests.HTTPError as e: body = getattr(e.response, "text", "")[:2000] print(f"HTTPError: {e}\nBody: {body}") except Exception as e: print(f"Erro: {e}")

if name == "main": asyncio.run(main())

Pregunta

O erro persiste: Erro: Não foi possível extrair a hash de subscription (WS/bundles). Que logs/info/requets voce precisa para solucionar esse erro? e como posso obter essas infos. Através de códigos? Console do WebTools. Pense profundamente

Pensamiento

Providing troubleshooting steps

To help debug the failure with extracting the subscription hash, we need to list the key logs required, like Playwright network logs, WS frames, and script sources. Missing subscription hash could point to scripts not loading or other factors like CF blocking or dynamic obfuscation. We should scan scripts for "*Subscription" patterns and analyze WS sniffing frames.

Considering failure reasons

The failure could be due to the page not triggering the subscription properly. If we intercepted the "sendMessageMutation" and provided a dummy response, the app might not progress to the subscription stage. Our sniffer is designed to capture subscription frames on page load, but the app might only subscribe after the real mutation or data load, missing our capture.

Troubleshooting bundle scanning issue

The failure might be due to changed obfuscation or missing "hash" in the JS bundle, possibly because the persisted query mapping is no longer in the client code. The "hash" could be server-defined or fetched through a different endpoint. To fix this, we could capture the subscription frame or check WebSocket and fetch POST flows.

Considering capture approach

Historically, the subscription happens via WebSocket with a "type: subscriptions" handshake, but the logs show earlier "receive_POST" calls. There's also an HTTP POST to get updates, possibly using long-polling instead of WebSockets. To troubleshoot, we need to capture POST requests to tch, so I'll advise capturing network logs for both wss and POST endpoints.

Providing troubleshooting steps

To assist with troubleshooting, I'll guide the user through capturing key logs and data. We’ll gather logs like HAR files, console logs, network events, script content, and headers like "poe-tchannel." I'll provide a checklist with minimal dev tools steps and a more extensive Python snippet to capture websockets, HTTP requests, and script data for further analysis. I'll keep it concise but detailed.

Thought for 1m 14s

Respuesta

Boa — se a extração da hash da subscription falha tanto pelo sniffer quanto pelos bundles, precisamos provar onde a assinatura realmente acontece no seu ambiente (WS vs HTTP long-poll), e capturar o payload real que o site usa. Aqui está exatamente o que eu preciso e como você consegue, por código e pelo DevTools.


O que eu preciso ver (na ordem de utilidade)

  1. Payload de registro de subscription que o site envia (o que contém type: "subscriptions").

    • Pode vir por WebSocket (frame enviado em wss://tch.../updates?channel=...) ou via HTTP para o TChannel (ex.: https://tch.../up/.../receive_POST).
    • Quero o JSON completo: queryName, variables e hash.
  2. HAR de rede cobrindo o envio do prompt (incluindo WS frames).

    • Isso permite ver se há receive_POST, redirecionamentos, headers (poe-*), cookies, etc.
  3. Dump dos scripts JS carregados + o que as regex acharam:

    • Lista de URLs de scripts (_next/static/...) e quais pares (queryName, hash) de *Subscription foram encontrados (se houver).
  4. Metadados da página:

    • poe-revision, poe-tag-id, poe-formkey.
    • __NEXT_DATA__ (ou pelo menos buildId/assetPrefix).
  5. Seu sendMessageMutation capturado (headers e body RAW) e a resposta do POST (para ver chatId).

    • Você já tem; só confirme os headers poe-* e se veio Set-Cookie: poe-tchannel.
  6. Snapshot de cookies/headers relevantes no exato momento do POST:

    • poe-tchannel-channel (cookie), poe-tchannel (header), poegraphql, cf_clearance, __cf_bm.
  7. Versões: Playwright e navegador em uso, e seu SO.


Como coletar — via DevTools (rápido e visual)

  1. Abra https://poe.com/<BOT> logado → F12 → aba Network.
  2. Marque Preserve log.
  3. Filtro: digite tch no filtro (ou poe.com em All).
  4. Envie sua mensagem no chat.
  5. Procure:
    • WS: uma conexão wss://tch*/up/*/updates?channel=... → clique → Frames → ache um frame ENVIADO com {"type":"subscriptions", ...}. Clique com o direito no frame → Copy message.
    • HTTP (se não houver WS): uma POST para https://tch*/up/*/receive_POST → aba Request Payload → procure type: "subscriptions" e copie o JSON.
  6. Ainda na aba Network, menu ⋯ → Save all as HAR with content (anexe esse HAR).
  7. Aba Sources → expanda _next/static/... → copie os nomes dos blobs JS maiores (os que lembram “framework”, “main” e uns “chunks”). Se preferir:
    Console → rode:
    js
    JSON.stringify({ scripts: [...document.scripts].map(s => s.src).filter(Boolean), poeRevision: document.querySelector('meta[name="poe-revision"]')?.content, poeTagId: document.querySelector('meta[name="poe-tag-id"]')?.content, buildId: JSON.parse(document.getElementById('__NEXT_DATA__')?.textContent||'{}')?.buildId }, null, 2)
    Copie o output.
  8. Console → pegue o __NEXT_DATA__ bruto (se couber):
    js
    document.getElementById('__NEXT_DATA__')?.textContent?.slice(0, 2000) // primeiros 2k
  9. Aba ApplicationCookieshttps://poe.com → tire print/cole os valores de poe-tchannel-channel, p-b, p-sb, cf_clearance.

O mais importante é o JSON do registro da subscription (WS frame ou POST). Sem ele, só dá pra chutar.


Como coletar — script de diagnóstico (Playwright)

Cole isto num diagnostic_probe.py. Ele:

  • grava um HAR,
  • loga frames de WS enviados/recebidos,
  • intercepta HTTP para tch (caso a subscription vá por POST),
  • varre scripts e salva os candidatos de Subscription.

Requer: pip install playwright websockets requests; depois playwright install chromium.

python
# diagnostic_probe.py import asyncio, json, re, pathlib from playwright.async_api import async_playwright OUT = pathlib.Path("poe_diag") OUT.mkdir(exist_ok=True) SUBS_ANY = re.compile(r'"([A-Za-z0-9_]*Subscription)"\s*:\s*\{[^}]*?"hash"\s*:\s*"([0-9a-f]{64})"', re.I|re.S) async def main(url="https://poe.com/GPT-5", prompt="diagnostic ping"): async with async_playwright() as p: ctx = await p.chromium.launch(headless=False) # grava HAR completo context = await ctx.new_context(record_har_path=str(OUT/"network.har"), record_har_content="embed") page = await context.new_page() ws_frames_file = (OUT/"ws_frames.jsonl").open("w", encoding="utf-8") tch_http_file = (OUT/"tch_http.jsonl").open("w", encoding="utf-8") subs_found = [] # WS sniffer def on_ws(ws): ws.on("framesent", lambda m: ws_frames_file.write(json.dumps({"dir":"sent","url":ws.url,"data":m})+"\n")) ws.on("framereceived", lambda m: ws_frames_file.write(json.dumps({"dir":"recv","url":ws.url,"data":m})+"\n")) page.on("websocket", on_ws) # Intercepta POSTs ao tch (fallback quando não há WS) async def route_tch(route): req = route.request post = req.post_data or "" rec = {"url": req.url, "method": req.method, "headers": req.headers, "post": post} tch_http_file.write(json.dumps(rec)+"\n") await route.continue_() await page.route(re.compile(r".*://tch[0-9]+\..*"), route_tch) # Captura respostas JS e varre por *Subscription async def on_response(resp): try: ctype = resp.headers.get("content-type","") if "javascript" in ctype: body = await resp.body() txt = body.decode("utf-8","ignore") for name, h in SUBS_ANY.findall(txt): subs_found.append({"url": resp.url, "queryName": name, "hash": h}) except Exception: pass page.on("response", on_response) await page.goto(url) # metadados meta = await page.evaluate("""() => ({ poeRevision: document.querySelector('meta[name="poe-revision"]')?.content || null, poeTagId: document.querySelector('meta[name="poe-tag-id"]')?.content || null, nextData: document.getElementById('__NEXT_DATA__')?.textContent?.slice(0, 5000) || null, scripts: Array.from(document.scripts).map(s => s.src).filter(Boolean) })""") (OUT/"meta.json").write_text(json.dumps(meta, indent=2, ensure_ascii=False), encoding="utf-8") # manda um prompt para forçar a página a registrar a subscription try: ta = page.locator("textarea").first await ta.click(); await ta.fill(prompt); await page.keyboard.press("Enter") except Exception: pass # espera um pouco para capturar frames/POSTs await page.wait_for_timeout(8000) (OUT/"subs_candidates.json").write_text(json.dumps(subs_found, indent=2), encoding="utf-8") # cookies (OUT/"cookies.json").write_text(json.dumps(await context.cookies(), indent=2), encoding="utf-8") # headers últimas requests relevantes (melhor virão no HAR) ws_frames_file.close(); tch_http_file.close() await context.close(); await ctx.close() if __name__ == "__main__": asyncio.run(main())

O que me enviar desse script:

  • poe_diag/network.har
  • poe_diag/ws_frames.jsonl
  • poe_diag/tch_http.jsonl
  • poe_diag/subs_candidates.json
  • poe_diag/meta.json
  • poe_diag/cookies.json

Se ws_frames.jsonl tiver uma linha "dir":"sent" com "type":"subscriptions", ali dentro estará a hash e o queryName que precisamos.
Se não tiver, cheque tch_http.jsonl: deve haver um POST com post contendo "type":"subscriptions" — pegue o mesmo trio de campos de lá.


Por que isso provavelmente está falhando no seu caso

  • Transporte diferente: alguns users/ab-tests usam HTTP long-poll no TChannel (POST receive_POST) em vez de WebSocket puro. Nosso sniffer atual só olha WS → não vê nada.
  • Manifesto de persisted queries não está nos bundles (às vezes o cliente baixa de um endpoint interno, não fica embutido), então a regex nos JS não acha as hashes.
  • Worker/contexto: o WS pode ser aberto por um Web Worker → ainda aparece no DevTools e no Playwright page.on("websocket"), mas é menos previsível; o HAR/frames confirma.

Depois que você me mandar um dos registros de subscription (WS ou POST), eu adapto o código para:

  • usar o mesmo queryName,
  • reutilizar exatamente as variables,
  • e, se preciso, assinar via HTTP (em vez de WS) quando o seu ambiente usar long-poll.

Se preferir, posso também te mandar um patch que logará no seu script atual:

  • quantos *Subscription apareceram nos bundles (com nomes/hashes),
  • se o sniffer viu algum frame type:"subscriptions",
  • e um interceptador adicional de https://tch*/up/* para capturar a versão HTTP.

Pregunta

curl 'wss://tch162575.tch.poe.com/up/chan117-8888/updates?min_seq=5943160320&channel=poe-chan117-8888-auljbfjjhmuudbnhgmiw&hash=10968266442456004397&generation=1'
-H 'Upgrade: websocket'
-H 'Origin: https://poe.com'
-H 'Cache-Control: no-cache'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Pragma: no-cache'
-H 'Connection: Upgrade'
-H 'Sec-WebSocket-Key: 2rrWJaH0dTPjgS/6+DpwOQ=='
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'Sec-WebSocket-Version: 13'
-H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' ;
curl 'wss://tch375236.tch.poe.com/up/chan117-8888/updates?min_seq=5943173146&channel=poe-chan117-8888-auljbfjjhmuudbnhgmiw&hash=10968266442456004397&generation=1'
-H 'Upgrade: websocket' \ e curl 'wss://tch162575.tch.poe.com/up/chan117-8888/updates?min_seq=5943160320&channel=poe-chan117-8888-auljbfjjhmuudbnhgmiw&hash=10968266442456004397&generation=1'
-H 'Upgrade: websocket'
-H 'Origin: https://poe.com'
-H 'Cache-Control: no-cache'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Pragma: no-cache'
-H 'Connection: Upgrade'
-H 'Sec-WebSocket-Key: 2rrWJaH0dTPjgS/6+DpwOQ=='
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'Sec-WebSocket-Version: 13'
-H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' ;
curl 'wss://tch375236.tch.poe.com/up/chan117-8888/updates?min_seq=5943173146&channel=poe-chan117-8888-auljbfjjhmuudbnhgmiw&hash=10968266442456004397&generation=1'
-H 'Upgrade: websocket'
-H 'Origin: https://poe.com'
-H 'Cache-Control: no-cache'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Pragma: no-cache'
-H 'Connection: Upgrade'
-H 'Sec-WebSocket-Key: O1G/Wn1CKYsXjQSHEXAbSg=='
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'Sec-WebSocket-Version: 13'
-H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits'
-H 'Origin: https://poe.com'
-H 'Cache-Control: no-cache'
-H 'Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6'
-H 'Pragma: no-cache'
-H 'Connection: Upgrade'
-H 'Sec-WebSocket-Key: O1G/Wn1CKYsXjQSHEXAbSg=='
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0'
-H 'Sec-WebSocket-Version: 13'
-H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits'" cookies: __cf_bm tVr9pakhYvLIUQMUmslhbU9TVomY_oKinMxI66ME_zk-1755607751-1.0.1.1-qxjXDKePJIplLs1P5_vms6430Go.CWO9D272hX8GjDaTcgvlmkQh7DOQy8sxAEDYlnyKU6lKRMdxUKA.foJzlR7GwCkk3mz8OVWsp07bH4M .poe.com / 2025-08-19T13:19:11.230Z 177 ✓ ✓ None Medium
_fbp fb.1.1755600520633.6733147262899197 .poe.com / 2025-11-17T12:32:14.000Z 39 Medium
_gcl_au 1.1.1600208785.1755600520 .poe.com / 2025-11-17T10:48:40.000Z 32 Medium
cf_clearance .NzxS1tc1T7.PIaeDl0wZK_SND._rUEv7fBuUmxXFYo-1755606697-1.2.1.1-RbOoZ3USZZtBhNMDuseQgQ4Sw1iZ_QEh6HpJvqkVDeHJN6DjlG4D6ml2BDF2BeyiOZ2DwWTbBXGbaLMiiSvltqKuJ4tgbmO9IxhwOshvNgiGahQS5kAydzAA1Y_vrYOY47wSfQ2cvUmgSY7LnO.NiNN_nt.v2l2C51uMRI5KeW6DBS6RTtaKw7DfmXd62CckTylFmJLCrkGkSQ48iHkHkIq5MFi8IqIesV5kXreDY_s .poe.com / 2026-08-19T12:31:36.860Z 310 ✓ ✓ None https://poe.com Medium
IDE AHWqTUlmCAkBhuA1-45pv34-mGB4Ce2u674CUypRsjF38mG1D9TnBd-16kl4gfTO .doubleclick.net / 2026-09-23T12:00:17.596Z 67 ✓ ✓ None Medium
OptanonAlertBoxClosed 2025-08-19T12:32:14.514Z .poe.com / 2026-02-15T12:32:14.000Z 45 Lax Medium
OptanonConsent isGpcEnabled=0&datestamp=Tue+Aug+19+2025+09%3A32%3A14+GMT-0300+(Hor%C3%A1rio+Padr%C3%A3o+de+Bras%C3%ADlia)&version=202405.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=NotLandingPage&groups=C0001%3A1%2CC0003%3A1%2CC0004%3A1&AwaitingReconsent=false&geolocation=BR%3BSC .poe.com / 2026-02-15T12:32:14.000Z 293 Lax Medium
p-b fnWI711UP20Z-5hhB4qmXA%3D%3D poe.com / 2026-09-23T12:49:13.566Z 31 ✓ ✓ None Medium
poe-tchannel-channel poe-chan117-8888-auljbfjjhmuudbnhgmiw poe.com / 2026-09-23T12:32:14.723Z 57 ✓ Lax Medium" Eaí? faltou algo? oque deu pra ver? bora.

Pensamiento

Analyzing provided logs and plan

The user provided some useful data. Based on their request, the next step is analyzing the WebSocket endpoints and channel cookie. It looks like the routing scheme is more complicated than expected, with numeric "clusters" indicating the issue. I'll need to adjust our WebSocket URL construction method.

Refining WebSocket URL construction

To refine the WebSocket URL, I could try parsing the 'poe-tchannel' cookie or response header to pinpoint the correct base URL. Alternatively, I might extract details from network logs or rely on a 'hash' parameter linked to updates. I'll also consider capturing the connection details directly, using Playwright's WS request.

Handling WebSocket URL and connection

To capture a WebSocket URL, I could use the 'page.on("websocket")' event and store the last seen ws.url. Reconnecting later might be tricky, but I can try reconnecting with the URL and cookies, even if some query parameters like 'min_seq' may be required for resuming. I'll modify the bootstrap process to capture the ws URL.

Analyzing WebSocket and HTTP Interception

It seems the WebSocket might not be sending a ‘subscriptions’ frame because subscriptions could be registered through a POST request instead. I'll need to intercept the 'receive_POST' calls to the tch domain and capture the 'subscriptions' payload. I'll extend the diagnostic script to include this interception, which was missing in the main code.

Capturing WebSocket Info and Adjusting Code

From your provided snippet, it looks like the use of multi-tenant tch hostnames means our code is creating the wrong WS URL based on the channel shard. Here's the fix: don't derive it from the shard but instead capture the exact WS URL using Playwright. Additionally, intercept the receive_POST to identify the subscriptions payload. I'll give you a precise minimal patch to adjust the existing code for capturing WS information and logging the relevant POST info.

Thought for 2m 28s

Respuesta

Boa! Com isso já dá pra enxergar 2 coisas importantes e o que ainda falta.

O que deu pra ver no seu dump

  • O host do WS não segue nosso cálculo tch{shard}.poe.com.
    Você está conectando em wss://tch162575.tch.poe.com/... e wss://tch375236.tch.poe.com/..., enquanto o channel é poe-chan117-8888-…. Ou seja: o subdomínio tchNNNNNN.tch.poe.com é dinâmico e não deriva de chan117. Nosso código que monta wss://tch{117}.poe.com/... pode estar indo para o host errado.
  • O cookie poe-tchannel-channel=poe-chan117-8888-… está ok e bate com a query channel=poe-chan117-8888-… nos seus URLs.
  • O parâmetro de query hash=10968266442456004397 não é a hash de persisted query da subscription (é um token/cursor do TChannel).
    Portanto, ainda precisamos do JSON de registro de subscription ({"type":"subscriptions", "subscriptions":{...}}) para obter queryName + hash + variables certos.

O que ainda falta (o “dado de ouro”)

O primeiro registro de subscription que o site envia:

  • ou como frame ENVIADO do WebSocket (Frames → Outgoing) com {"type":"subscriptions", …},
  • ou como POST para https://tch*.poe.com/up/.../receive_POST cujo body contém esse mesmo JSON.

Sem esse JSON não dá para inferir, com segurança, a hash da persisted query.


Como capturar exatamente isso (duas vias)

A) DevTools (rápido e visual)

  1. Abra o chat logado → F12 → Network → marque Preserve log.
  2. Envie uma mensagem curta (“ping”).
  3. No filtro, digite tch. e:
    • Se houver item WS …/updates?channel=… → clique → aba Frames → selecione um frame “sent” (saída) que contenha {"type":"subscriptions"…}Copy message.
    • Se não houver “sent” em WS, procure um POST …/receive_POSTRequest Payload → copie o JSON completo (deve começar com {"type":"subscriptions"…}).
  4. Ainda no Network, menu ⋯ → Save all as HAR with content (guarde o arquivo).
  5. Na aba Application → Cookies (https://poe.com), anote os valores de p-b, cf_clearance, __cf_bm, poe-tchannel-channel.

Me envie o JSON do registro de subscription e, se possível, o HAR. O JSON sozinho já resolve.

B) Script de diagnóstico (por código)

Se preferir automatizar, rode este probe (ele grava HAR, frames de WS e POSTs do TChannel), sem precisar mexer na sua conta:

python
# diagnostic_probe.py import asyncio, json, re, pathlib from playwright.async_api import async_playwright OUT = pathlib.Path("poe_diag"); OUT.mkdir(exist_ok=True) SUBS_ANY = re.compile(r'"([A-Za-z0-9_]*Subscription)"\s*:\s*\{[^}]*?"hash"\s*:\s*"([0-9a-f]{64})"', re.I|re.S) async def main(url="https://poe.com/GPT-5", prompt="diagnostic ping"): async with async_playwright() as p: # HAR com conteúdo para debug total browser = await p.chromium.launch(headless=False) context = await browser.new_context(record_har_path=str(OUT/"network.har"), record_har_content="embed") page = await context.new_page() ws_frames = (OUT/"ws_frames.jsonl").open("w", encoding="utf-8") tch_posts = (OUT/"tch_http.jsonl").open("w", encoding="utf-8") subs_candidates = [] # 1) Sniff de WS (captura URL e frames) def on_ws(ws): ws_frames.write(json.dumps({"kind":"ws_open","url":ws.url})+"\n") ws.on("framesent", lambda m: ws_frames.write(json.dumps({"kind":"sent","url":ws.url,"data":m})+"\n")) ws.on("framereceived", lambda m: ws_frames.write(json.dumps({"kind":"recv","url":ws.url,"data":m})+"\n")) page.on("websocket", on_ws) # 2) Intercepta chamadas HTTP ao TChannel (caso o registro vá por POST) async def route_tch(route): req = route.request post = req.post_data or "" tch_posts.write(json.dumps({"url": req.url, "method": req.method, "headers": req.headers, "post": post})+"\n") await route.continue_() await page.route(re.compile(r".*://tch[^/]+/up/.*"), route_tch) # 3) Varre JS por *Subscription (às vezes ajuda) async def on_response(resp): try: if "javascript" in resp.headers.get("content-type",""): txt = (await resp.body()).decode("utf-8","ignore") for name, h in SUBS_ANY.findall(txt): subs_candidates.append({"url": resp.url, "queryName": name, "hash": h}) except: pass page.on("response", on_response) await page.goto(url) # metadados úteis meta = await page.evaluate("""() => ({ poeRevision: document.querySelector('meta[name="poe-revision"]')?.content || null, poeTagId: document.querySelector('meta[name="poe-tag-id"]')?.content || null, nextData: document.getElementById('__NEXT_DATA__')?.textContent?.slice(0,5000) || null, scripts: Array.from(document.scripts).map(s => s.src).filter(Boolean) })""") (OUT/"meta.json").write_text(json.dumps(meta, indent=2), "utf-8") # força a página a registrar subscriptions try: ta = page.locator("textarea").first await ta.click(); await ta.fill(prompt); await page.keyboard.press("Enter") except: pass await page.wait_for_timeout(8000) (OUT/"subs_candidates.json").write_text(json.dumps(subs_candidates, indent=2), "utf-8") (OUT/"cookies.json").write_text(json.dumps(await context.cookies(), indent=2), "utf-8") ws_frames.close(); tch_posts.close() await context.close(); await browser.close() if __name__ == "__main__": asyncio.run(main())

Arquivos gerados (os mais valiosos):

  • poe_diag/ws_frames.jsonlprocure uma linha com "kind":"sent" cujo "data" contenha "type":"subscriptions".
  • poe_diag/tch_http.jsonl → se não houver frame “sent”, procure uma entrada cujo "post" contenha "type":"subscriptions".
  • poe_diag/network.har → confirma headers/cookies/ordem dos eventos.

Ajustes que já dá para aplicar no seu código (com base no que você mostrou)

  1. Pare de “chutar” o host do WS.
    Em get_bootstrap, quando ouvir page.on("websocket"), salve ws.url do updates?channel=… e retorne isso como ws_url_sniffed.
    No listen_via_websocket, se ws_url_sniffed vier, use exatamente essa URL em vez de construir tch{shard}.poe.com.

  2. Capture também o registro por HTTP.
    Adicione um page.route(r".*://tch[^/]+/up/.*", handler) na captura para gravar qualquer POST cujo body contenha "type":"subscriptions". Se achar, retorne sub_query, sub_hash, sub_vars a partir daí.

Com isso, mesmo que a página use long-poll em vez de WS “framesent”, você ainda pega o mesmo JSON de subscription e elimina a causa do erro.

Se quiser, eu te mando um patch enxuto que:

  • retorna ws_url_sniffed,
  • intercepta receive_POST,
  • e cai para bundles se não achar subscription por WS/HTTP.

Pregunta

DO GQL POST: {"queryName":"subscriptionsMutation","variables":{"subscriptions":[{"subscriptionName":"messageAdded","query":null,"queryHash":"da2ccd97624a3f371d65bc0ff48fd6207774b8c922a1d22127dc0a21d4209d1c"},{"subscriptionName":"messageCancelled","query":null,"queryHash":"14647e90e5960ec81fa83ae53d270462c3743199fbb6c4f26f40f4c83116d2ff"},{"subscriptionName":"messageDeleted","query":null,"queryHash":"4d051234adc284d8fc5671d407398461d3eb48fc43e0b42678f6aee71d54ed02"},{"subscriptionName":"messageRead","query":null,"queryHash":"902cdc53772ed7623a0854944787a0909dff6181fe2236736cce25c628dc397a"},{"subscriptionName":"messageEdited","query":null,"queryHash":"806d519542f694592a8bbef726279fc6f630ea0c5e58ff920c4fcb90690b3554"},{"subscriptionName":"messageCreated","query":null,"queryHash":"c0a3cd3e54940fe99c71c944ef525fc301a27bba029a55622cf720fb5d5dae31"},{"subscriptionName":"messageStateUpdated","query":null,"queryHash":"117a49c685b4343e7e50b097b10a13b9555fedd61d3bf4030c450dccbeef5676"},{"subscriptionName":"messageAttachmentAdded","query":null,"queryHash":"65798bb2f409d9457fc84698479f3f04186d47558c3d7e75b3223b6799b6788d"},{"subscriptionName":"messageFollowupActionAdded","query":null,"queryHash":"d2e770beae7c217c77db4918ed93e848ae77df668603bc84146c161db149a2c7"},{"subscriptionName":"messageMetadataUpdated","query":null,"queryHash":"71c247d997d73fb0911089c1a77d5d8b8503289bc3701f9fb93c9b13df95aaa6"},{"subscriptionName":"messageReactionsUpdated","query":null,"queryHash":"3b991ab9b5f281584c9b0f8a6099cbe614bc18bd55efeadd09818a55df2ea057"},{"subscriptionName":"messageTextUpdated","query":null,"queryHash":"800eea48edc9c3a81aece34f5f1ff40dc8daa71dead9aec28f2b55523fe61231"},{"subscriptionName":"jobStarted","query":null,"queryHash":"c8b0a1fa651db0384cb8bc56bbe4f1d6c0cef28bd1e8176c0d0be2a20bb75fc7"},{"subscriptionName":"jobUpdated","query":null,"queryHash":"961c92a9b49fa30e67ee1a9c6a276a92829aecf9135000d6ba69efaf15df91a3"},{"subscriptionName":"jobCostUpdated","query":null,"queryHash":"e70526859ec541bf2c459bd6ca3137c709a864a270675d72bac69ec45a02b2ac"},{"subscriptionName":"viewerStateUpdated","query":null,"queryHash":"df4bc6e11a5ca737262148fec3fab26e920e15a58f956f624d0ed0bb62f3e765"},{"subscriptionName":"canvasTabClosed","query":null,"queryHash":"7b26a0f049c7742c4484ea0cbd98dcdd97f31638fd01c0ee988b8cbf9e967328"},{"subscriptionName":"canvasTabOpened","query":null,"queryHash":"2d4c4b2be6e4b92bd02fe83ebc3b1df32b639f80559224ddffae677e745e8cb7"},{"subscriptionName":"canvasTabBackgrounded","query":null,"queryHash":"975fc8f9c48f0c16737e490ed1059e59690d3f5f499ad0cb8a24f2ad8575666d"},{"subscriptionName":"onDataToForwardToCanvasTab","query":null,"queryHash":"3306309cb5a1d7e19867ced094f779a22d28c5c6fc617dfa136d11f51c7cee0c"},{"subscriptionName":"chatTitleUpdated","query":null,"queryHash":"ee062b1f269ecd02ea4c2a3f1e4b2f222f7574c43634a2da4ebeb616d8647e06"},{"subscriptionName":"chatDeletedV2","query":null,"queryHash":"05ca4e5f143a6429f11de0d852a9402ad770dd76f44bc1712f587338f0fa211e"},{"subscriptionName":"chatAddedV2","query":null,"queryHash":"9bc7956944b310796b2ab951bb79bf1ebfb028d3d7061406172dd562ded964ab"},{"subscriptionName":"knowledgeSourceUpdated","query":null,"queryHash":"7de63f89277bcf54f2323008850573809595dcef687f26a78561910cfd4f6c37"},{"subscriptionName":"messagePointLimitUpdated","query":null,"queryHash":"b0c1e2d10ffdd723aa293bf69c2f929712bf9dd5d51d7101b2fb630941104a03"},{"subscriptionName":"chatMemberAddedWithContext","query":null,"queryHash":"77bfa9aea6fc1cc402319640e41e23e6eca654d7454ffd06a4a0c3912c53e58c"},{"subscriptionName":"chatMemberRemoved","query":null,"queryHash":"7f06f5d6fbd3549000b771f00df13944f4186a4dc54d0cd652822a1d81a82729"},{"subscriptionName":"userRemovedFromChat","query":null,"queryHash":"ac46d057797562a5d0f1d2c05410cd5d42da3e6f54e07cc56629d307d0df0944"},{"subscriptionName":"chatSettingsUpdated","query":null,"queryHash":"76806efbd2d584ba9e2e515f79045a8fb2015ecb5b8e9a25bade2843fcf5fee7"},{"subscriptionName":"chatModalStateChanged","query":null,"queryHash":"43bfc9c29b32a5de8245f9d960b7baa8f05353b09e67b3335c73d92acc7497cd"},{"subscriptionName":"defaultBotOfChatChanged","query":null,"queryHash":"3fb52f71aa7ebb491b604e3547dd3ed5b269a80cb836fab98d611d8c810c4fb3"},{"subscriptionName":"messageFollowupActionUpdated","query":null,"queryHash":"f7b8c46f2b835d6c23942ea36e91cc6cd127ac6974183cf657bb27365f24143a"},{"subscriptionName":"unseenCountsUpdated","query":null,"queryHash":"11a7aad16ff8420d49a50626e84098d98626485204df275325b0a202cb7e79d8"},{"subscriptionName":"chatMuteStatusUpdated","query":null,"queryHash":"97563dd19a520bacc607de851c84df0c75bc882ecff92aa37ac2c0b3b49e8ed3"},{"subscriptionName":"allChatsDeleted","query":null,"queryHash":"84ad1c004c3e516bc0e0f6eb1553c045d72eda45f7c749f8a8b4c49a28c491b2"},{"subscriptionName":"userFollowersUpdated","query":null,"queryHash":"4adbb81a4652b86232dabe5c63297dc0d62a909001bc33d4d9f508a5b7b9b66d"},{"subscriptionName":"userFollowingUpdated","query":null,"queryHash":"976349f61a530a41b94c29e64423885beec722fcbc8635d659e83430600756bb"},{"subscriptionName":"viewerFollowersUpdated","query":null,"queryHash":"3c6003f0bcece0fff4f601da92b00e32ae22f20c9e8282f02deab047eb6cf85c"}]},"extensions":{"hash":"5a7bfc9ce3b4e456cd05a537cfa27096f08417593b8d9b53f57587f3b7b63e99"}}

Pensamiento

Refining subscription method

Looks like "subscriptionsMutation" is used to register server subscriptions via GraphQL, not WS-level frames. We need to POST to the GraphQL endpoint with the query "subscriptionsMutation" and use the provided data like subscriptionName and queryHash. No need for WS "type":"subscriptions" now — that’s why our previous approach failed. We should focus on intercepting that GraphQL request for mapping and data.

Proposed next steps

The user wants an immediate analysis. We need to adjust code to intercept the "subscriptionsMutation" payload during bootstrap and save subscriptionName, queryHash. When connecting to WS, we just open it without sending any "type: subscriptions" payload, and then handle updates, likely filtered by "chatId." The user did provide the payload.

Refining event handling

It seems like "messageAdded" might include events across all chats, as the payload had "query": null and no clear filtering mechanism. To ensure we only get updates for the correct chat, we will need to filter by chatId in the "messageAdded" event. For the WS URL, we need to figure out the right one, possibly using intercepts or cookies.

Finalizing WebSocket URL method

Instead of manually constructing the host, we can extract it from the "poe-tchannel" header or "Set-Cookie" or from the previous 'gql POST' response header. Although the host number is still unclear, we can use WebSocket URL sniffing, which we’ve successfully implemented with Playwright. We'll return and reuse the snatched ws_url in the get_bootstrap method.

Clarifying code update steps

To address the issue, we need to:

  1. Detect the subscriptionsMutation and intercept it for the capture of the raw payload and subscription info.
  2. Rewrite the WebSocket connection handling by relying on ws_url_sniffed (captured from the sniffer) instead of computing host dynamically.
  3. Update the code to ensure no sub_hash error is thrown, and that all necessary headers are included.
  4. Modify the listen_via_websocket function to accept ws_url.

Here’s the updated code to implement these changes, ensuring we rely on the captured payload and WebSocket URL, with no unnecessary manual configuration.

Finalizing code update

To address the error:

  1. We'll ensure get_bootstrap returns ws_url_sniffed, subs_mutation_raw, and related headers.
  2. Modify the route handler for intercepting subscriptionsMutation and leave it to continue as expected.
  3. Implement logic to handle WebSocket connection setup with the appropriate headers.
  4. Send a re-registered subscription to set up

Thought for 2m 34s

Respuesta

Perfeito — esse subscriptionsMutation que você capturou muda o jogo: o cliente registra todas as subscriptions via GraphQL POST (com cada subscriptionName + queryHash) e não envia mais um frame {"type":"subscriptions"} no WebSocket. Então nosso erro vinha de procurar uma chatMessagesSubscription nos bundles/WS.

Abaixo está o código completo atualizado que:

  • intercepta subscriptionsMutation (guarda o payload e os headers),
  • sniffa a URL EXATA do WebSocket que o site abriu (host tchNNNNNN.tch.poe.com dinâmico),
  • reenvia o subscriptionsMutation com os headers/COOKIE capturados,
  • reenvia a sendMessageMutation 1:1,
  • conecta no mesmo WS sniffado sem mandar frame de “subscriptions” e consome os eventos (messageTextUpdated, messageAdded etc.), filtrando pelo chatId.

Cole e rode. Ele elimina a dependência daquela “sub_hash” antiga e usa exatamente o que seu ambiente usa hoje.

python
# -*- coding: utf-8 -*- # Poe GraphQL sender — Reenvio 1:1 + subscriptionsMutation + WS sniffer (host dinâmico) # # Estratégia resumida: # 1) get_bootstrap(): abre a página logada, intercepta: # - sendMessageMutation (headers + body RAW) — NÃO envia (fulfill 200) # - subscriptionsMutation (headers + body RAW) — só captura (deixa passar) # - sniffa a URL exata do WebSocket "…/updates?channel=…" # 2) main(): reenvia subscriptionsMutation com headers/cookie capturados; # reenvia a sendMessageMutation (1:1) e obtém chatId; # conecta ao mesmo WS sniffado (sem mandar "type: subscriptions") e lê os eventos. # import asyncio import json import re from typing import Optional, Dict, Any, List, Tuple import urllib.parse import requests import websockets from playwright.async_api import async_playwright # ============================================================================== # 0) CONFIG – ajuste seus cookies/sessão aqui # ============================================================================== P_B_COOKIE = "fnWI711UP20Z-5hhB4qmXA%3D%3D" # obrigatório (cookie de sessão p-b) P_LAT_COOKIE = "" # opcional CF_CLEARANCE = "" # opcional (Cloudflare) CF_BM = "" # opcional P_SB = "" # opcional BOT_NAME = "GPT-5" # slug visível na URL PROMPT = "Olá, tudo bem, qm é voce?" # mensagem a enviar POE_URL_ROOT = "https://poe.com" POE_API_URL = f"{POE_URL_ROOT}/api/gql_POST" BASE_HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0", "Accept": "*/*", "Accept-Language": "pt-BR,pt;q=0.9,en;q=0.8", "Origin": POE_URL_ROOT, "Referer": f"{POE_URL_ROOT}/{BOT_NAME}", "Sec-Ch-Ua": '"Not;A=Brand";v="99", "Microsoft Edge";v="139", "Chromium";v="139"', "Sec-Ch-Ua-Mobile": "?0", "Sec-Ch-Ua-Platform": '"Windows"', "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "Content-Type": "application/json", "poegraphql": "0", } # ============================== UTILS ========================================= def cookie_header_from_jar(jar: requests.cookies.RequestsCookieJar) -> str: return "; ".join(f"{c.name}={c.value}" for c in jar) def parse_cookie_header_and_set(session: requests.Session, cookie_header: str): """Aplica um Cookie header literal no cookie jar (para uso posterior no WS/POST).""" if not cookie_header: return parts = [p.strip() for p in cookie_header.split(";") if "=" in p] for part in parts: try: k, v = part.split("=", 1) session.cookies.set(k.strip(), v.strip(), domain="poe.com", path="/") except Exception: continue # ============================== PARSERS ======================================== def extract_text_pieces(event: Any) -> List[str]: out: List[str] = [] if isinstance(event, dict): for k in ("text_new", "response", "delta", "text", "partial_response"): v = event.get(k) if isinstance(v, str) and v: out.append(v) for v in event.values(): if isinstance(v, (dict, list)): out.extend(extract_text_pieces(v)) elif isinstance(event, list): for x in event: out.extend(extract_text_pieces(x)) return out def looks_complete(node: Dict[str, Any]) -> bool: state = (node.get("state") or node.get("message_state") or "").lower() return state in {"complete", "completed", "stopped", "aborted"} # ============================== BOOTSTRAP ====================================== async def get_bootstrap(bot_name: str, cookie_dict: Dict[str, str], prompt_for_capture: str) -> Dict[str, Optional[str]]: """ Intercepta: - sendMessageMutation (captura e FULFILL 200 — não envia) - subscriptionsMutation (captura e deixa seguir) Sniffa: - URL exata do WebSocket "…/updates?channel=…" Retorna headers/JSON/cookies necessários para replays fiéis. """ async with async_playwright() as p: browser = await p.chromium.launch(headless=True) context = await browser.new_context() # Injeta cookies de sessão add = [] for name in ("p-b", "p-lat", "cf_clearance", "__cf_bm", "p-sb"): val = cookie_dict.get(name) if val: add.append({"name": name, "value": val, "domain": "poe.com", "path": "/", "secure": True}) if add: await context.add_cookies(add) page = await context.new_page() captured = { # sendMessageMutation "send_payload_raw": None, "send_payload_dict": None, "send_req_headers": {}, "send_cookie_header": None, # subscriptionsMutation "subs_payload_raw": None, "subs_payload_dict": None, "subs_req_headers": {}, "subs_cookie_header": None, # metas "formkey_hdr": None, "revision_hdr": None, "tag_id_hdr": None, "tchannel_hdr": None, # ws "ws_url": None, } # Sniffer WS: guarde a URL exata do updates?channel def on_ws(ws): url = ws.url or "" if "/updates?channel=" in url: captured["ws_url"] = url page.on("websocket", on_ws) # Route /api/gql_POST async def route_handler(route, request): try: if request.url.endswith("/api/gql_POST"): hdrs = {k.lower(): v for k, v in request.headers.items()} body = request.post_data or "" qn = hdrs.get("poe-queryname", "") # capture metas if "poe-formkey" in hdrs: captured["formkey_hdr"] = hdrs["poe-formkey"] if "poe-revision" in hdrs: captured["revision_hdr"] = hdrs["poe-revision"] if "poe-tchannel" in hdrs: captured["tchannel_hdr"] = hdrs["poe-tchannel"] if "poe-tag-id" in hdrs: captured["tag_id_hdr"] = hdrs["poe-tag-id"] if qn == "sendMessageMutation" or "sendMessageMutation" in (body or ""): captured["send_req_headers"] = {**captured["send_req_headers"], **hdrs} captured["send_payload_raw"] = body if "cookie" in hdrs: captured["send_cookie_header"] = hdrs["cookie"] try: captured["send_payload_dict"] = json.loads(body) except Exception: pass # NÃO enviar de verdade — simulamos 200 await route.fulfill(status=200, content_type="application/json", body='{"data":{"messageCreate":null}}') return # subscriptionsMutation: só capturar e deixar passar if qn == "subscriptionsMutation" or '"queryName":"subscriptionsMutation"' in (body or ""): captured["subs_req_headers"] = {**captured["subs_req_headers"], **hdrs} captured["subs_payload_raw"] = body if "cookie" in hdrs: captured["subs_cookie_header"] = hdrs["cookie"] try: captured["subs_payload_dict"] = json.loads(body) except Exception: pass await route.continue_() return except Exception: pass await route.continue_() await page.route("**/api/gql_POST", route_handler) await page.goto(f"{POE_URL_ROOT}/{bot_name}", wait_until="domcontentloaded") # Digita o prompt real e "envia" — será interceptado try: locator = page.locator("textarea") if await locator.count() > 0: ta = locator.first await ta.click() await ta.fill(prompt_for_capture) else: ed = page.locator('div[contenteditable="true"]').first await ed.click() await ed.fill(prompt_for_capture) await page.keyboard.press("Enter") except Exception: pass # Aguarda capturas for _ in range(120): got_send = bool(captured["send_payload_raw"]) got_subs = bool(captured["subs_payload_raw"]) got_ws = bool(captured["ws_url"]) if got_send and (got_subs or got_ws): break await page.wait_for_timeout(200) try: await page.unroute("**/api/gql_POST", route_handler) except Exception: pass await context.close(); await browser.close() if not captured["send_payload_raw"]: raise RuntimeError("Falha: não capturei a sendMessageMutation (body RAW).") return { # send "send_payload_raw": captured["send_payload_raw"], "send_payload_dict": captured["send_payload_dict"], "send_req_headers": captured["send_req_headers"], "send_cookie_header": captured["send_cookie_header"], # subs "subs_payload_raw": captured["subs_payload_raw"], # pode ser None, mas tentamos reusar "subs_payload_dict": captured["subs_payload_dict"], "subs_req_headers": captured["subs_req_headers"], "subs_cookie_header": captured["subs_cookie_header"], # metas "formkey": captured["formkey_hdr"], "revision": captured["revision_hdr"], "tag_id": captured["tag_id_hdr"], "tchannel_hdr": captured["tchannel_hdr"], # ws "ws_url": captured["ws_url"], } # ============================== WS LISTENER ==================================== async def listen_via_websocket_url(ws_url: str, session: requests.Session, target_chat_id: Optional[str]) -> str: """ Conecta exatamente no ws_url sniffado (host dinâmico) e só ESCUTA. Não envia frame "subscriptions". Filtra eventos do chat alvo quando possível. """ ws_headers = { "Origin": "https://poe.com", "User-Agent": BASE_HEADERS["User-Agent"], "Cookie": cookie_header_from_jar(session.cookies), "Accept-Language": BASE_HEADERS.get("Accept-Language", "en-US,en;q=0.9"), "Cache-Control": "no-cache", "Pragma": "no-cache", } full = "" async with websockets.connect(ws_url, extra_headers=ws_headers, max_size=None) as ws: async for message in ws: try: data = json.loads(message) except Exception: continue if data.get("mtype") != "subscriptionUpdate": continue payloads = data.get("payload", {}).get("payloads", []) for p in payloads: d = p.get("data") or {} # As várias formas de evento: # - messageTextUpdated: { message: { chatId, text_new, state } } # - messageAdded/messageUpdated: { message: {...} } # - ou caminhos aninhados nodes = [] for key in ("messageTextUpdated", "messageAdded", "messageUpdated", "messageCreated", "messageStateUpdated"): node = d.get(key) if isinstance(node, dict): nodes.append(node) # alguns responses têm {messageTextUpdated: {...}, message: {...}} if not nodes and isinstance(d, dict): for v in d.values(): if isinstance(v, dict) and ("text_new" in v or "message" in v): nodes.append(v) for node in nodes: # extrai mensagem aninhada se existir msg = node.get("message") if isinstance(node.get("message"), dict) else node chat_id_here = str(msg.get("chatId") or msg.get("chat_id") or "") if target_chat_id and chat_id_here and str(target_chat_id) != chat_id_here: # evento de outro chat — ignora continue pieces = extract_text_pieces(msg) if pieces: chunk = "".join(pieces) print(chunk, end="", flush=True) full += chunk if looks_complete(msg) or looks_complete(node): print("\n--- Resposta Completa (WS) ---") return full return full # ============================== DIAGNÓSTICO ==================================== def summarize_payload(payload_base: Dict[str, Any]) -> str: vars_obj = (payload_base or {}).get("variables") or {} exts_obj = (payload_base or {}).get("extensions") or {} qn = (payload_base or {}).get("queryName") sdid = vars_obj.get("sdid") bot = vars_obj.get("bot") h = exts_obj.get("hash") return f"qn:{qn} bot:{str(bot)[:12]}… sdid:{str(sdid)[:12]}… ext_hash:{str(h)[:8]}…" # ================================= MAIN ======================================== async def main(): session = requests.Session() session.headers.update(BASE_HEADERS) # Cookies base no jar session.cookies.update({"p-b": P_B_COOKIE}) if P_LAT_COOKIE: session.cookies.set("p-lat", P_LAT_COOKIE, domain="poe.com", path="/") if CF_CLEARANCE: session.cookies.set("cf_clearance", CF_CLEARANCE, domain="poe.com", path="/") if CF_BM: session.cookies.set("__cf_bm", CF_BM, domain="poe.com", path="/") if P_SB: session.cookies.set("p-sb", P_SB, domain="poe.com", path="/") try: info = await get_bootstrap( BOT_NAME, {"p-b": P_B_COOKIE, "p-lat": P_LAT_COOKIE, "cf_clearance": CF_CLEARANCE, "__cf_bm": CF_BM, "p-sb": P_SB}, PROMPT, ) # =========== SUBSCRIPTIONS MUTATION (registro) =========== subs_raw = info.get("subs_payload_raw") subs_hdrs = {k.lower(): v for k, v in (info.get("subs_req_headers") or {}).items()} subs_cookie_hdr = info.get("subs_cookie_header") or "" if subs_cookie_hdr: parse_cookie_header_and_set(session, subs_cookie_hdr) if subs_raw: print("Registrando subscriptions via subscriptionsMutation (replay 1:1)…") blocked = {"content-length", "host", "connection", "accept-encoding"} gql_headers_subs = {k: v for k, v in subs_hdrs.items() if k not in blocked} gql_headers_subs["content-type"] = "application/json" gql_headers_subs["origin"] = POE_URL_ROOT gql_headers_subs["referer"] = f"{POE_URL_ROOT}/{BOT_NAME}" if subs_cookie_hdr: gql_headers_subs["cookie"] = subs_cookie_hdr resp_subs = session.post(POE_API_URL, data=subs_raw, headers=gql_headers_subs) if "poe-tchannel" in resp_subs.headers: session.headers["poe-tchannel"] = resp_subs.headers["poe-tchannel"] resp_subs.raise_for_status() else: print("Aviso: não capturei subscriptionsMutation; seguirei com WS apenas (pode já estar registrado no canal).") # =========== SEND MESSAGE (replay 1:1) =========== send_raw = info.get("send_payload_raw") send_hdrs = {k.lower(): v for k, v in (info.get("send_req_headers") or {}).items()} send_cookie_hdr = info.get("send_cookie_header") or "" if send_cookie_hdr: parse_cookie_header_and_set(session, send_cookie_hdr) if not send_raw: raise RuntimeError("Não capturei a sendMessageMutation (body RAW).") print("Enviando a pergunta via GraphQL com payload/headers CAPTURADOS…") blocked = {"content-length", "host", "connection", "accept-encoding"} gql_headers_send = {k: v for k, v in send_hdrs.items() if k not in blocked} gql_headers_send["content-type"] = "application/json" gql_headers_send["origin"] = POE_URL_ROOT gql_headers_send["referer"] = f"{POE_URL_ROOT}/{BOT_NAME}" if send_cookie_hdr: gql_headers_send["cookie"] = send_cookie_hdr resp = session.post(POE_API_URL, data=send_raw, headers=gql_headers_send) if "poe-tchannel" in resp.headers: session.headers["poe-tchannel"] = resp.headers["poe-tchannel"] resp.raise_for_status() data = resp.json() root = data.get("data", {}) if isinstance(data, dict) else {} chat = None if "messageCreate" in root: chat = (root.get("messageCreate") or {}).get("chat") or {} elif "messageEdgeCreate" in root: chat = (root.get("messageEdgeCreate") or {}).get("chat") or {} if not chat: raise RuntimeError("Resposta sem objeto 'chat' esperado (messageCreate/messageEdgeCreate).") chat_id = chat.get("chatId") or chat.get("id") if not chat_id: raise RuntimeError("Não consegui obter o chatId.") print(f"Chat criado! ID: {chat_id}") # =========== WS LISTEN =========== ws_url = info.get("ws_url") if not ws_url: raise RuntimeError("Não capturei a URL do WebSocket (updates?channel=…). Reexecute e garanta que o sniffer pegou o WS.") print(f"Conectando ao WS: {ws_url}") final_answer = await listen_via_websocket_url(ws_url, session, str(chat_id)) print("\nRESPOSTA FINAL:") print(final_answer) except requests.HTTPError as e: body = getattr(e.response, "text", "")[:2000] print(f"HTTPError: {e}\nBody: {body}") except Exception as e: print(f"Erro: {e}") if __name__ == "__main__": asyncio.run(main())

Por que isso resolve no seu cenário

  • Você mostrou que o cliente usa subscriptionsMutation com vários subscriptionName/queryHash. O script agora captura e reenvia exatamente essa mutação, em vez de procurar uma chatMessagesSubscription.
  • O host do WS (tch162575.tch.poe.com, etc.) é dinâmico. Em vez de “adivinhar”, o script sniffa a URL real aberta pela página e reutiliza essa mesma para ouvir os updates.
  • Sem necessidade de mandar {"type":"subscriptions"} no WS — quem faz o registro é o POST GraphQL. O listener apenas consome e filtra pelo chatId.

Compartir este Q&A