Browser CLI
The plugin adds Crawl4AI’s browser commands to the crawl CLI: a
persistent builtin browser that many crawls can share, a standalone CDP browser, and browser
profiles for crawling as a logged-in user. They run through the core command, as pam crawl ...
in a PAM project or pam vendor/bin/crawl ... elsewhere. Without the plugin, these commands print
an install hint and exit with 2.
Rendering From The Command Line
Section titled “Rendering From The Command Line”pam crawl https://app.example.com --render # only pages that need JavaScriptpam crawl https://app.example.com --render always # every pagepam crawl https://app.example.com --render always --engine lightpandapam crawl https://app.example.com --render always --no-headless # watch the browserpam crawl https://example.com/login --c4a login.c4a -o md # C4A-Script| Option | Description |
|---|---|
--render [auto|always] |
Turn rendering on; auto when no value is given |
--engine auto|chrome|lightpanda |
Engine selection |
--cdp URL|builtin |
Render through a CDP endpoint, or the builtin browser |
-p NAME, --profile NAME |
Use a saved browser profile |
--[no-]headless |
Show or hide the browser window |
--c4a file.c4a |
Run a C4A-Script file in the page |
Crawl4AI-style -b settings work too: -b browser_mode=builtin, cdp_url=...,
user_data_dir=..., headless=false and browser_type=....
The Builtin Browser
Section titled “The Builtin Browser”The builtin browser is a persistent Chrome with CDP enabled. Start it once and point crawls at it, so they skip the browser start-up and share its cookies:
pam crawl browser start [--port 9222] [--no-headless]pam crawl browser status [--json] # PID, port, ws:// URL, profile directorypam crawl browser view [--url URL] [--open] # CDP and DevTools URLs, open tabspam crawl browser restart [--port N]pam crawl browser stop
pam crawl https://example.com --cdp builtin -o mdIt runs detached, in its own session, with the profile
~/.local/share/pam-crawl/builtin-browser/user-data, and records its PID, port and websocket URL in
state.json next to it. view --url opens a new tab at that URL; view --open shows a viewer
window with the tab list.
stop closes the browser over CDP and, if needed, signals only the saved PID, after checking that
the process is still Chrome running on that profile. A stale or reused PID is never signalled.
Standalone CDP Browser
Section titled “Standalone CDP Browser”crawl cdp starts a Chrome with CDP enabled in the foreground, for your own tools or for another
crawler to connect to:
pam crawl cdp [--port 9222] [-d DIR] [--headless] [--incognito] [--url URL]It uses a temporary profile unless you pass -d DIR (--user-data-dir), and stops exactly the
Chrome it launched when you press Enter or q, on Ctrl-C or SIGTERM, or when you close the
window.
Profiles
Section titled “Profiles”A profile is a Chrome user data directory with your cookies and storage. Create one by logging in by hand, then crawl as that user:
pam crawl profiles create work [--url https://login.example.com] # a visible Chrome opens: log in, press Enterpam crawl profiles listpam crawl https://example.com/account --profile work -o mdpam crawl profiles delete work [--force]Profiles live in ~/.local/share/pam-crawl/profiles/<name> ($XDG_DATA_HOME is respected).
create also saves a portable storage_state.json with the profile’s cookies, like Crawl4AI.
Profiles that are open in a browser are never deleted or shrunk.
In PHP, use a profile through the userDataDir render option or BrowserConfig::$userDataDir:
Crawl::url('https://example.com/account') ->renderOptions(fn ($o) => $o->with(['userDataDir' => getenv('HOME').'/.local/share/pam-crawl/profiles/work'])) ->get();Shrinking Profiles
Section titled “Shrinking Profiles”Profiles grow with caches and history. shrink keeps exactly what Crawl4AI keeps at each level
(cookies, local storage, IndexedDB, preferences…) and deletes the rest:
pam crawl shrink work --level aggressive --dry-run # light | medium | aggressive | minimalpam crawl shrink work --level aggressive--dry-run only reports what would be deleted.
This product includes software developed by UncleCode (https://x.com/unclecode) as part of the Crawl4AI project (https://github.com/unclecode/crawl4ai).