bolone-sengkuni/hermes-brutal-mod/har-derived-api-client
Claude Code and agent skill by bolone-sengkuni/hermes-brutal-mod
- community
Checking that the SKILL.md file is still in the repository.
Record a site's XHR into a HAR, derive an HTTP client.
Install
npx vskill@latest install bolone-sengkuni/hermes-brutal-mod/har-derived-api-clientSKILL.md
The same SKILL.md was published earlier as bolone-sengkuni/hermes-brutal-mod/har-derived-api-client.
HAR-Derived API Client
Drive a website once with a real browser while recording its network traffic to a HAR file, then distill that HAR into the site's private JSON API so you can call it directly with plain HTTP — far cheaper and faster than browser-controlling the page on every request. Credit: trick by Jared Longster, popularized by Dax (thdxr). This captures and replays; it does NOT bypass auth, solve CAPTCHAs, or defeat bot-detection — if the site needs a logged-in session, you carry its headers/cookies forward, you don't forge them.
The scripts are stdlib-plus-Playwright: capture needs Playwright, derivation is pure stdlib, replay needs only requests/httpx (or curl).
Covers every Hermes browser pathway: the default local browser_navigate backend, plus the cloud/remote backends (Browserbase, Browser-Use, Firecrawl) and any /browser connect CDP endpoint. There are two capture scripts — one for a browser you launch, one for a browser you attach to over CDP — because HAR recording works differently in each case (see How to Run).
When to Use
- "Build a CLI/client for <website>" — derive its API instead of scripting clicks.
- "This site has no public API but the page clearly fetches JSON."
- You're about to loop
browser_navigatefor the same query repeatedly — stop and derive the endpoint once. - Reverse-engineering an autocomplete, search, feed, or checkout XHR.
- You captured a session on a cloud backend (Browserbase / Browser-Use / Firecrawl) or via
/browser connectand want the API without re-renting the browser.
Prerequisites
- Playwright + a browser binary (capture step only):
pip install playwrightthenplaywright install chromium- (If a system Playwright already has browsers under
~/.cache/ms-playwright, reuse it.) requestsorhttpxfor the replay step (stdliburllibalso works).- No API keys. Any keys/tokens the client needs are the ones the HAR captured.
- For the CDP path (
har_capture_cdp.py): a reachable CDP endpoint. On Hermes,
run /browser connect to print the active endpoint, or read BROWSER_CDP_URL / browser.cdp_url in config. Cloud backends expose it as cdpUrl/connectUrl.
How to Run
Scripts under this skill's scripts/, invoked through the terminal tool. Pick the capturer by pathway — this is the part that trips people up:
| Browser pathway | How Hermes reaches it | Capturer | |
|---|---|---|---|
Local browser_navigate (default, agent-browser/Playwright) | launched locally | har_capture.py | |
Camofox (CAMOFOX_URL set) | local REST/CDP | har_capture_cdp.py if it exposes CDP, else drive it yourself | |
| Browserbase / Browser-Use / Firecrawl (cloud) | CDP (cdpUrl) | har_capture_cdp.py | |
/browser connect <url> / BROWSER_CDP_URL | CDP | har_capture_cdp.py |
Rule of thumb: if Hermes *launched* the browser, use `har_capture.py`; if it *connected to* one over CDP, use `har_capture_cdp.py`. har_capture.py uses Playwright's record_har_path, which only works on a locally-owned context. har_capture_cdp.py attaches with connect_over_cdp() and assembles the HAR from page.on("request"/"response") events, because record_har_path is unavailable on a connected browser.
Then, for either path:
har_to_client.py— filters the HAR to XHR/fetch/JSON, groups by endpoint, and prints params, headers, bodies, and replay hints (User-Agent / cookie / auth).
Resolve paths against this skill's directory. Canonical loop:
Quick Reference
Procedure
- Pick the capturer by pathway (see How to Run table). Launched-locally →
har_capture.py; reached over CDP →har_capture_cdp.py. On Hermes,/browser connecttells you the CDP endpoint when a cloud/remote backend is active. - Find the interaction. Open the site with
browser_navigate(or--headedcapture) to see which selector to type into / click, and confirm a JSON XHR fires in devtools/network. - Capture the HAR via the
terminaltool. Order--actionto reach the request:fillthe box, thensleeplong enough for the debounced XHR, and always leave--waitat the end so late responses flush. Both capturers embed response bodies, so the derived client sees real payload shapes. - Derive with
har_to_client.py --host <domain>. Read off: the method, the URL/path template (numeric/UUID segments collapse to{id}), query params, request-body JSON, and the### Replay hintsblock. - Write the client. Recreate the request exactly — same method, path, query params, body. Send the headers the site actually needs: at minimum copy the User-Agent from the replay hints. If hints report cookies or an auth/token header, resend those too.
- Test browserless. Run the client with the
terminaltool and confirm it returns the same data the browser saw. This is the payoff: no browser in the loop. - (Optional) Wrap as a CLI — a small
argparsescript over the derived call, e.g.search.py "frank herbert".
Worked example (Wikipedia search-title, derived + replayed live):
Pitfalls
- Default library User-Agent gets 403. Many sites (Wikipedia, Cloudflare-fronted APIs) reject
python-requests/x.y. Always send the browser UA from the replay hints. This is the #1 reason a derived client fails when the browser succeeded. - A failed `--action` aborts before the HAR flushes — you get no file. If capture errors on a selector, the run produced nothing; fix the selector (use
--headedto watch) and rerun. Don't debug a missing HAR. - Server-rendered pages have no XHR to derive —
har_to_client.pyprints "No API-looking entries". The data came in the HTML; scrape it or find the interaction that does fetch JSON. - Debounced/typeahead XHRs need a real pause. Add
--action "sleep:3"afterfill; typing alone won't have fired the request when the HAR closes. - Auth/session endpoints need the captured
Cookie/Authorizationheader, and those expire. The derived client is only as durable as the credential; re-capture when it 401s. HARs contain live secrets — treatout.haras sensitive and delete it after deriving. - `record_har_content="embed"` makes big HARs. Use
--max-bodyto cap what's printed; the file itself can be large for media-heavy pages. - Endpoints shift. Sites change private APIs without notice. Re-run the capture→derive loop when a client breaks rather than patching URLs by hand.
- Wrong capturer = empty/no HAR.
har_capture.pyon a cloud/CDP backend records nothing (it launches its own local browser instead of the one you meant).har_capture_cdp.pyneeds the endpoint; on Hermes get it from/browser connectorBROWSER_CDP_URL. Match the capturer to the pathway (How to Run table). - Headless-Chrome UA is a weak tell. Local/agent-browser capture yields a
HeadlessChrome/...User-Agent; some sites sniff the "Headless" token. Cloud backends (Browserbase/Browser-Use) send a real desktop-Chrome UA, so a client derived from a cloud capture replays more reliably. If a headless-derived client 403s where the browser didn't, swap the "Headless" UA for a normal Chrome UA string before assuming the endpoint changed. - CDP capture doesn't close the browser.
har_capture_cdp.pyattaches to a browser it doesn't own and leaves it running — correct for cloud/remote sessions Hermes manages. Don't add a close; let the owning backend tear it down.
Verification
End-to-end proof against a live site with no API key:
Expect the derivation to print GET https://en.wikipedia.org/w/rest.php/v1/search/title with q and limit params and a JSON pages response — then replay it with the Procedure snippet and confirm matching titles come back over plain HTTP.
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/web-development/har-derived-api-client/SKILL.md
Popularity
- Repository stars
- 24
- Repository forks
- 17
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/bolone-sengkuni/hermes-brutal-mod/har-derived-api-client)