har-derived-api-client
できること
このスキルは、ブラウザーがそのサイトを使っている間のネットワーク通信をAIに観察させ、その記録をサイトのデータを直接呼び出す簡単なクライアントに変えます。公開APIのないサイトを自動化する開発者向けです。
使う場面
- ✓公開APIはないが、データをJSONで読み込んでいるウェブサイトのクライアントがほしいとき。
- ✓AIが同じブラウザーの操作を何度も繰り返そうとしていて、直接のリクエストのほうが速いとき。
- ✓ウェブサイトが使う自動補完や検索の機能を自動化したいとき。
スキルのリンク
https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/web-development/har-derived-api-client/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このサイトの掲載情報を直接検索するクライアントを作ってください。毎回ページをクリックしなくて済むようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、ブラウザーのネットワーク通信をHARファイルに記録し、ページが使うエンドポイントを抽出します。AIは、標準のHTTPツールを使ってそれらのリクエストを再生し、すでにあるログインのセッションがあれば引き継ぎます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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 Chromium that
browser_exec drives, 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_execnavigations for 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 --no-shell- (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 connectto print the active endpoint, or readBROWSER_CDP_URL/browser.cdp_urlin config. Cloud backends expose it ascdpUrl/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 Chromium (default browser_exec browser) |
launched locally | har_capture.py |
| 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:
# 1a. Capture, LOCAL browser (Hermes launched it)
python3 scripts/har_capture.py "https://SITE/" out.har \
--action "fill:input[name=search]:my query" --action "sleep:3" --wait 2
# 1b. Capture, CDP browser (cloud backend or /browser connect)
# get the endpoint from /browser connect or BROWSER_CDP_URL
python3 scripts/har_capture_cdp.py "ws://HOST/devtools/browser/..." out.har \
--goto "https://SITE/" --action "fill:input[name=search]:my query" \
--action "sleep:3" --wait 2
# 2. Derive — read the endpoints out of the HAR
python3 scripts/har_to_client.py out.har --host SITE --max-body 400
# 3. Replay — write a tiny client from the printed endpoint (see Procedure)
Quick Reference
har_capture.py <url> <out.har> [--wait S] [--headed] [--action SPEC ...]
action SPEC: fill:SELECTOR:TEXT | press:SELECTOR:KEY | click:SELECTOR
goto:URL | sleep:SECONDS (run in order after page load)
use when Hermes LAUNCHED the browser (local browser_exec default)
har_capture_cdp.py <cdp_url> <out.har> [--goto URL] [--wait S] [--action SPEC ...]
sa
よくある質問
ログインやCAPTCHAを突破できますか?
いいえ。スキルは、認証の回避、CAPTCHAの解決、ボット検知の突破を行わないとしています。
どのブラウザーに対応していますか?
スキルは、ローカルのChromiumブラウザーと、クラウドやリモートのブラウザーのバックエンドに対応し、2つの記録スクリプトを使います。
記録を実行するには何が必要ですか?
記録にはPlaywrightが必要です。抽出と再生の手順には、標準のPythonかcurlだけが必要です。
詳細
人気
- GitHubのスター
- 260k
- ランキング
- #578
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-merge-conflict-arbiter
260k並行して動く2つのエージェントのブランチ間のgitマージ競合を、中立的な第三者として解決し、リポジトリに1つのマージ結果を作ります。
antigravity-cli
260kAntigravityのコマンドラインツールのインストール、更新、トラブルシューティングをガイドし、そのプラグイン、サインイン、サンドボックスも扱います。
blackbox
260kBlackbox AIのコマンドラインツールに、コーディングのタスクを渡します。このツールは複数のAIモデルを動かし、最も良い結果を選びます。
dynamic-workflow
260k多くの似た作業の大きな束を、保存されたスクリプトとして実行し、検証済みの結果だけをメインの会話に返すようエージェントに教えます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。