Aller au contenu
Skillpedia
API et serveurs (backend)260k · #578

har-derived-api-client

Ce qu’il fait

Ce skill fait observer à votre IA l'activité réseau d'un site pendant qu'un navigateur l'utilise, puis transforme cet enregistrement en un client simple qui appelle directement les données du site. Il s'adresse aux développeurs qui doivent automatiser un site sans API publique.

Quand l’utiliser

  • ✓Quand vous voulez un client pour un site web sans API publique mais qui charge ses données au format JSON.
  • ✓Quand votre IA doit répéter plusieurs fois les mêmes étapes de navigateur et qu'une requête directe serait plus rapide.
  • ✓Quand vous voulez automatiser une fonction d'autocomplétion ou de recherche utilisée par un site web.

Lien du skill

https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/web-development/har-derived-api-client/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/web-development/har-derived-api-client/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Construis un petit client qui recherche directement les annonces de ce site, pour que je n'aie pas à cliquer sur la page à chaque fois.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le skill enregistre le trafic réseau du navigateur dans un fichier HAR, puis extrait les points d'accès utilisés par la page. Votre IA rejoue ces requêtes avec des outils HTTP simples et reprend toute session de connexion déjà ouverte.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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_exec navigations 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 connect and want the API without re-renting the browser.

Prerequisites

  • Playwright + a browser binary (capture step only):
    • pip install playwright then playwright install chromium --no-shell
    • (If a system Playwright already has browsers under ~/.cache/ms-playwright, reuse it.)
  • requests or httpx for the replay step (stdlib urllib also 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 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
Questions fréquentes

Contourne-t-il les connexions ou les CAPTCHA ?

Non. Le skill indique qu'il ne contourne pas l'authentification, ne résout pas les CAPTCHA et ne déjoue pas la détection des robots.

Avec quels navigateurs fonctionne-t-il ?

Le skill couvre le navigateur Chromium local et les backends de navigateur cloud ou distants, grâce à deux scripts de capture.

De quoi ai-je besoin pour la capture ?

La capture nécessite Playwright, et les étapes de dérivation et de rejeu n'ont besoin que de Python standard ou de curl.

Détails

Description originale de l’auteur

Record a site's XHR into a HAR, derive an HTTP client.

repo: NousResearch/hermes-agent

Popularité

Étoiles GitHub
260k
Position au classement
#578
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires