cyrus-and/chrome-har-capturer ? reverse-engineered prompt

Reverse engineered prompt

Build me a Node.js tool that can connect to a running Chrome browser and capture a HAR file for one or more URLs.

I want both a command line app and a small library API. The CLI should let me pass Chrome host and port, choose output file or print to stdout, set window size, add extra headers, override the user agent, ignore certificate errors, allow cache, capture response bodies, block certain URL patterns, wait a bit after page load, set timeouts, retry failed pages, and run multiple pages in parallel.

The library should expose a simple function for loading a batch of URLs and emit events for when each page starts, finishes, fails, and when the final HAR is ready. It should also support hooks before and after each page load so I can customize things like cookies or extra setup.

Also include a lower level helper that can turn raw Chrome DevTools protocol events into a single page HAR, including optional response bodies and websocket activity. Look up the current Chrome debugging docs online if you need to.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab