An open API service indexing awesome lists of open source software.

https://github.com/kevcui/putility

:wrench: Puppeteer script-kit
https://github.com/kevcui/putility

puppeteer scripting scriptkit

Last synced: about 1 month ago
JSON representation

:wrench: Puppeteer script-kit

Awesome Lists containing this project

README

          

putility
=========

putility.js is a [puppeteer](https://github.com/puppeteer/puppeteer/) script toolkit. It contains some small and useful functions for daily usage.

## Dependency

- [puppeteer-core](https://github.com/puppeteer/puppeteer/): core library of puppeteer, headless Chrome
- [commander](https://github.com/tj/commander.js): argument options parser

## Installation

```bash
npm i puppeteer-core commander
```

## How to use

```
Usage: ./putility.js [-u ] [-w ] [-p ] [-c ] [-s]

Options:
-u, --agent optional, browser user agent
-w, --wait optional, wait for n milliseconds
-p, --path optional, path to chrome/chromium binary
default "/usr/bin/chromium"
-c, --cmd optional, one or multiple commands:
["html", "screenshot", "cookie", "header"]
default "html"
-s, --show optional, show browser
default not show
-h, --help display help for command
```

## Function

- Take screenshot: `-c screenshot`, take screenshot of whole page

- Fetch HTML: `-c html`, dump tag as output text

- Fetch cookie: `-c cookie`, dump site cookie as output json

- Fetch response header: `-c header`, dump response header as output json