1.8 KiB
1.8 KiB
Local Chrome Screenshot Extension (Unpacked)
This is a local-only setup (no publishing) that:
- Captures the visible tab as a PNG from a Chrome extension popup.
- Sends it to a local HTTP server on
127.0.0.1. - Extracts simplified page content (text + a pruned “content tree”) from the active tab.
- The server saves it into
./screenshots/and optionally runs a local script.
1) Start the local server
From the project root (recommended: use a venv):
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
export OPENAI_API_KEY="..."
python3 tools/local_screenshot_bridge.py --port 8765 --out-dir screenshots --ai
Notes:
- The server listens on
http://127.0.0.1:8765/screenshot. - If you omit
--ai, it will only save files (no OpenAI call). - If you set
--ai, it will generate reply suggestions and return them back to the extension (and also save*.ai.json). - If you're debugging, add
--log-level debug(or setAIEA_LOG_LEVEL=debug) for more detail. - Optional: you can still use
--run ...as a post-save hook.
2) Load the extension (unpacked)
- Open Chrome:
chrome://extensions - Enable "Developer mode"
- Click "Load unpacked"
- Select:
chrome_screenshot_ext/
3) Use it
- Click the extension icon.
- Confirm the endpoint is
http://127.0.0.1:8765/screenshot. - Optionally add "Extra instructions" (saved locally in the extension).
- Click "Capture".
- Use the "History" dropdown + "Show" to view older AI suggestions.
Saved files land in screenshots/:
YYYYMMDDTHHMMSSZ-<title-slug>.pngYYYYMMDDTHHMMSSZ-<title-slug>.jsonYYYYMMDDTHHMMSSZ-<title-slug>.content.jsonYYYYMMDDTHHMMSSZ-<title-slug>.ai.json(whenOPENAI_API_KEYis set)
Alternatively create .env in the project root:
OPENAI_API_KEY=...