Expand description
Chrome DevTools Protocol client.
Talks to a logged-in Chrome/Chromium exposing CDP (default
http://127.0.0.1:9222) to do two things grabcli can’t do with HTTP alone:
export_cookies: read the browser’s Grab cookies (Storage.getCookies) so the user never pastes credentials.mint_hydra: open afood.grab.compage in the browser, let it mint a realx-hydra-jwt, and sniff the header off the network events.evaluate_in_origin: evaluate JS in a tab on a given origin (used to mint GrabMart reCAPTCHA v3 tokens onmart.grab.com).Browser: drive one tab inside an isolated browser context (Target.createBrowserContext) forgrab auth login; the context has its own cookies and outlives the process until disposed.
The endpoint is any CDP-speaking browser the user is logged into; grabcli
doesn’t assume a particular one. It only drives a tab it opens or a tab
already on food.grab.com, and never touches unrelated tabs.
Structs§
- Browser
- A browser-level CDP connection used to drive one page inside an
isolated browser context (
Target.createBrowserContext): its own cookie jar and storage, shared with no other tab, so nothing else in the browser can log it out and it can’t disturb the user’s tabs. - Page
Info - A page target as listed by
/json(no websocket needed).
Functions§
- default_
context_ cookies - The grab.com cookies of the browser’s default context (the user’s
normal tabs):
Storage.getCookieson the browser connection without abrowserContextId. Values stay in memory; callers never print them. - evaluate_
in_ origin - Evaluate a JavaScript
expressionin a browser tab onorigin(e.g.https://mart.grab.com) and return its JSON value. Promises are awaited. - export_
cookies - Export Grab cookies from the browser into
session, preserving any hydra token already present. Returns the browser User-Agent. - mint_
hydra - Mint a hydra JWT by driving the browser: open/select a
food.grab.comtab, navigate it topage, and sniff thex-hydra-jwtrequest header. Updatessession.hydra_jwt,hydra_expandweb_app_version. - pages
- All
pagetargets of the browser, fromGET /json. Read-only: nothing is attached to or changed.