Skip to content

KevCui/putility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

putility

putility.js is a puppeteer script toolkit. It contains some small and useful functions for daily usage.

Dependency

Installation

npm i puppeteer-core commander

How to use

Usage: ./putility.js <url> [-u <user_agent>] [-w <millisecond>] [-p <path>] [-c <cmd1,cmd2...>] [-s]

Options:
  -u, --agent <user_agent>  optional, browser user agent
  -w, --wait <millisecond>  optional, wait for n milliseconds
  -p, --path <binary_path>  optional, path to chrome/chromium binary
                            default "/usr/bin/chromium"
  -c, --cmd <cmd1,cmd2...>  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

Releases

No releases published

Packages

No packages published