░██╗░░░░░░░██╗██████╗░███████╗███╗░░██╗░█████╗░██╗░░██╗
░██║░░██╗░░██║██╔══██╗██╔════╝████╗░██║██╔══██╗██║░░██║
░╚██╗████╗██╔╝██████╔╝█████╗░░██╔██╗██║██║░░╚═╝███████║
░░████╔═████║░██╔══██╗██╔══╝░░██║╚████║██║░░██╗██╔══██║
░░╚██╔╝░╚██╔╝░██║░░██║███████╗██║░╚███║╚█████╔╝██║░░██║
░░░╚═╝░░░╚═╝░░╚═╝░░╚═╝╚══════╝╚═╝░░╚══╝░╚════╝░╚═╝░░╚═╝
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░█████╗░██████╗░██╗░░░░░░░██████╗░█████╗░██████╗░░█████╗░██████╗░███████╗██████╗░
██╔══██╗██╔══██╗██║░░░░░░██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗
███████║██████╔╝██║█████╗╚█████╗░██║░░╚═╝██████╔╝███████║██████╔╝█████╗░░██████╔╝
██╔══██║██╔═══╝░██║╚════╝░╚═══██╗██║░░██╗██╔══██╗██╔══██║██╔═══╝░██╔══╝░░██╔══██╗
██║░░██║██║░░░░░██║░░░░░░██████╔╝╚█████╔╝██║░░██║██║░░██║██║░░░░░███████╗██║░░██║
╚═╝░░╚═╝╚═╝░░░░░╚═╝░░░░░░╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░░░░╚══════╝╚═╝░░╚═╝
A simple tool to capture and save API responses using Playwright.
It supports both interactive mode (Q&A in terminal) and CLI options for advanced users.
- Run as a terminal app:
api-logger - Two modes:
- Interactive (for beginners)
- CLI Options (for advanced users)
- Save responses in the
out/folder as JSON or Binary - Regex filtering for API requests
- Option to run in headless (hidden browser) or visible mode
git clone https://github.com/Aliazadi-1776/playwright-api-response-logger.git
cd playwright-api-response-loggernpm installnpm link
⚠️ If you face permission issues:sudo npm link
Before linking, ensure the CLI script is executable:
chmod +x bin/api-loggerapi-loggerThe program will ask you these questions:
- Target site URL → e.g.,
digikala.com - API filter regex → e.g.,
apiorgraphql - Headless mode → Yes/No
- Timeout → Execution time in ms (0 = infinite)
api-logger --url https://digikala.com --filter api --headless --timeout 30000| Option | Description |
|---|---|
--url |
Target site URL (example: https://digikala.com) |
--filter |
Regex to filter API requests (default: api) |
--headless |
Run browser in headless mode |
--timeout |
Execution time in milliseconds (example: 30000 = 30s) |
playwright-api-logger/
├── bin/
│ └── api-logger # Terminal executable
├── lib/
│ ├── banner.js # Banner printing
│ ├── cli.js # CLI & input management
│ └── logger.js # Main logging logic
├── package.json
├── README.md
└── .gitignore
- CLI interactive mode
- CLI options (url, filter, headless, timeout)
- Export to CSV
- Config file support
- Docker support
Contributions, issues and feature requests are welcome!
Feel free to open an issue or submit a pull request.